Server Administration & Management

How to Install pecl_http PHP Extension

The pecl_http php extension is used to provide a convenient and powerful set of functionality for most of PHP’s applications ,like HTTP urls, dates, redirects, headers and messages, provides means for negotiation of clients preferred language and charset, as well as a convenient way to send any arbitrary data with caching and resuming capabilities. You can easily install it on Linux server using pecl or pear command.

This is a quick guide on how to compile pecl_http, as sometimes it has a little trouble compiling with the system’s cURL libraries.

1. Login to server via SSH.

2. Go into your compile directory:

# cd /usr/local/src/

3. Download the library:

# wget pecl download pecl_http

4. Bundle it in the current directory:

# pecl bundle pecl_http

5. Go into the pecl_http source directory:

# cd pecl_http*

6. Prepare the build environment:

# phpize

7. Configure the build with cPanel’s cURL SSL library:

# ./configure –with-http-curl-requests=/opt/curlssl

Note:- You must have cURLSSL already built by EasyApache

8. Compile it:

# make && make install

9. Add the extension to PHP:

# echo “extension=http.so” >> /usr/local/lib/php.ini

10 .Restart Apache:

# /etc/init.d/httpd stop

# /etc/init.d/httpd start

Once it done you will have add “extension=http.so” line to php.ini file.

April 12, 2011 Posted by | cPanel, PHP | , , | Leave a comment