Oliver Nassar

Installing PECL HTTP Package on Ubuntu 11.10

July 15, 2012

In order to use the http_build_url function in PHP, I apparently need the http PECL library.

So, I was hoping the installation of the PECL HTTP library would be as easy as: sudo pecl install pecl_http.

Well, that didn't work. The PHP: Installing the HTTP extension - Manual tried to have me believe the following was the right combination of characters:

sudo apt-get install libcurl3 php5-dev libcurl4-gnutls-dev libmagic-dev
sudo pecl install pecl_http

Damn. No luck. Errors out with:

ERROR: `/tmp/pear/temp/pecl_http/configure --with-http-curl-requests=y --with-http-zlib-compression=y --with-http-magic-mime=y --with-http-shared-deps' failed

At this point I tried compiling it manually, and got errors including (as I made my way down the rabbit hole of installing multiple dependencies):

checking for curl/curl.h... not found
configure: error: could not find curl/curl.h

...

cl_http-1.7.4/missing.c -o missing.lo 
libtool: compile: Failed to create `.libs'
make: *** [missing.lo] Error 1

Until I finally found the winning solution (well, for my Ubuntu 11.10 server):

sudo apt-get install -y curl libcurl3 libcurl4-gnutls-dev libmagic-dev
sudo pecl install pecl_http

At this point, I just added in extension=http.so in the php.ini file, restarted apache using sudo /etc/init.d/apache2 restart, and was on my way.

Hope that helps :)