pecl_http failed to load

iEmad picture iEmad · Jan 12, 2014 · Viewed 9.6k times · Source

This is my server configuration:

  • CentOS release 6.5 (Final)
  • PHP 5.5.7
  • pecl_http 2.0.4 stable
  • Server version: Apache/2.2.15 (Unix)

I have everything up and running except when I tried to load the pecl_http module it gives me the following warning and it won't load:

PHP Warning:  PHP Startup: Unable to load dynamic library '/path/to/php/modules/http.so' - /path/to/php/modules/http.so: undefined symbol: php_persistent_handle_abandon in Unknown on line 0

I tried to look everywhere but without a luck. The install seems fine but I don't know what's wrong with it.

Answer

amurrell picture amurrell · Jan 29, 2014

I came here with the same problem - I couldn't get 2.0.4 to work - in hopes of helping you or others that stumble here, I invite you to check out my answer on serverfault here.

For your convenience I've also copied it below:


I didn't have a setup problem - at least not to my knowledge. I am running nginx + php5-fpm. My php.ini file was correctly configured and all my other extensions were working properly - test it with phpinfo() or php --ini.

My problem with pecl_http (HttpRequest) was the extension's version (2.0.4). Check your version by running in the command line

pecl list

I was unable to get pecl_http-2.0.4 to work, but I was able to run

pecl uninstall pecl_http

then

pecl install pecl_http-1.7.6. Make sure you have libcurl installed as well or you might experience install failures.

After restarting php5-fpm and my webserver (nginx) everything was working prefectly!


EXTRA HELP:

Before you install - and pear is installed - you may want to run these two commands assuming you are using the php.ini in fpm - or you can write the path according to your configuration:

pear config-set php_ini /etc/php5/fpm/php.ini
pecl config-set php_ini /etc/php5/fpm/php.ini

This makes it so that pecl knows which php.ini file you are using with your web-server and will add the extension=http.so in the correct spot. This helped me so maybe it'll help you too!