Posted by & filed under Linux, PHP, Web Server.

I was recently tasked with getting the pecl_http package installed on a server. I already hade PECL all setup (which can be its own nightmare), and I had cURL installed. But, there is a mystery package which needed to be installed first.

tlhunter@amalthea:~ $ sudo pecl install pecl_http
downloading pecl_http-1.7.4.tgz ...
Starting to download pecl_http-1.7.4.tgz (174,503 bytes)
.........done: 174,503 bytes
71 source files, building
running: phpize
Configuring for:
PHP Api Version:         20100412
Zend Module Api No:      20100525
Zend Extension Api No:   220100525
whether to enable cURL HTTP requests; specify libcurl directory [yes] :

...
checking for curl/curl.h... not found
configure: error: could not find curl/curl.h
ERROR: `/tmp/pear/temp/pecl_http/configure --with-http-curl-requests --with-http-zlib-compression --with-http-magic-mime=no --with-http-shared-deps' failed

To fix this error, issue the following command, which will install the cURL headers required by pecl_http:

sudo apt-get install libcurl4-openssl-dev

Then, try to install pecl_http again:

sudo pecl install pecl_http

Once that is done, add “extension=http.so” to your php.ini file, and you should be good to go.

Thomas Hunter II

Thomas is the author of Advanced Microservices and a prolific public speaker with a passion for reducing complex problems into simple language and diagrams. His career includes working at Fortune 50's in the Midwest, co-founding a successful startup, and everything in between.

Tags: