Install PECL_HTTP on CentOS

In order to use handy HTTP extension in your PHP code you need to use install it first, as it doesn’t come with PHP core installation.

Below are the steps to install it on CentOS:

  1. Install PHP Pear if not installed yet:
    yum install php-pear
  2. Install GCC if not installed yet:
    yum install gcc
  3. Install cURL if not installed yet:
    yum install curl-devel

    Otherwise you’ll get the following message while installing PECL_HTTP:

    configure: error: could not find curl/curl.h

  4. Start the main installation:
    /usr/bin/pecl install pecl_http

    You can use default values when answering installation questions

  5. Add the following line to /etc/php.ini file:
    extension=http.so
  6. Restart your apache server so the extension can be loaded:
    httpd -k restart

You should now be able to use it. hope I saved you some time 🙂

Leave a comment