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.
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!
Since version 2 PECL HTTP requires modules raphf and propro to be loaded before http. So edit your php.ini or php.d/pecl_http.ini or whereever you load modules, so it looks like:
extension=raphf.so
extension=propro.so
extension=http.so
Source:
http://www.php.net/manual/en/http.install.php#113769
When it comes to installing from PECL or PEAR, I too always seem to run in to "something" that prevents a module from working as it should. The above error is actually pretty common on Ubuntu & Debian.
The packages provided by Ubuntu & Debian do not automatically install all dependencies required for every module, so I had to hunt down a solution between StackExchange, Google and the developers website.
What fixed this for me (note: on Debian, not CentOS), was installing the following packages:
php5-phpdbg php5-dev php-http zlib1g-dev libcurl4-openssl-dev libevent-dev imagemagick libmagick++-dev imagemagick-common libmagic-dev libghc-iconv-dev libpcre3-dev
The package marked as just php-http is intentional. This specific package doesn't carry a 5, thus unless you knew you needed it, you'd most likely overlook it. So for those on Ubuntu and/or Debian systems, search on both php5 and php (using --names-only helps narrow down the packages).
I'm mentioning this in hopes that it'll help others that may have the same issue on a similar system. I'm not 100% on the package names for the CentOS repository, though having the names of the packages needed in general may help you and others to narrow down the list.
Once the packages are installed, simply uninstall & reinstall the pecl_http package, restart php5-fpm and the error should go away; confirmed by creating a phpinfo file.
I'd like to expand on Jack Miller's answer. I'm using OpenSUSE, and it puts extension=******.so loaders into /etc/php5/conf.d dir, split into multiple files. For example:
ctype.ini debug.ini exif.ini http.ini imagick.ini mbstring.ini mysqli.ini opcache.ini pdo.ini pdo_sqlite.ini raphf.ini tokenizer.ini xmlreader.ini xsl.ini curl.ini dom.ini gd.ini iconv.ini json.ini memcache.ini mysql.ini openssl.ini pdo_mysql.ini propro.ini sqlite3.ini xdebug.ini xmlwriter.ini zlib.ini
Naturally, it loads them one by one using glob, which means they get loaded in an alphabetical order, and you guessed it - raphf.ini loads after http.ini.
Renaming raphpf.ini something like a_raphf.ini does the trick.