1

For some reason pecl_http extension is not showing up in my test.php file with contains:

<?php phpinfo(); ?> 

I just installed pecl_http using:

pecl install pecl_http

The install was successful and I verified it by running:

pecl list

Installed packages, channel pecl.php.net: ========================================= Package Version State mongo 1.2.10 stable pecl_http 1.7.4 stable 

I then located my php.ini file using:

php -i | grep 'Configuration File'

Configuration File (php.ini) Path => /etc/php5/cli Loaded Configuration File => /etc/php5/cli/php.ini 

I edited it in vim and added:

extension=http.so

Finally I restarted Nginx and PHP-FastCGI:

/etc/init.d/nginx restart /etc/init.d/php-fastcgi stop /etc/init.d/php-fastcgi start 

My PHP extension_dir is :

/usr/lib/php5/20090626

I verified that "http.so" is located in that directory.

Any ideas why it's not loading?

My machine is running a Ubuntu 10.04 LTS 64bit Profile on Linode. The only other extensions I have installed are New Relic and Mongo.

Thanks!

5
  • Just to be sure try loading extansion using full path: extension=/usr/lib/php5/20090626/http.so Commented Jun 28, 2012 at 20:32
  • @c2h5oh nope same results Commented Jun 28, 2012 at 20:35
  • What happens when you run echo http_get("http://www.google.com"); in a PHP script? When you filter your phpinfo command with http, do you see things like http_request listed? Commented Jun 28, 2012 at 20:49
  • @qweet I get this error Fatal error: Call to undefined function http_get() Commented Jun 28, 2012 at 21:03
  • @qweet php -i | grep 'http_request' returns the following: http_request => N/A => 0 => 0 http_request_datashare => GLOBAL => 1 => 0 http_request_pool => N/A => 0 => 0 Commented Jun 28, 2012 at 21:04

3 Answers 3

4

Look at your phpini file paths:

Configuration File (php.ini) Path => /etc/php5/cli Loaded Configuration File => /etc/php5/cli/php.ini 

CLI is the Command Line interface. Check phpinfo() from your webserver and edit the correct php.ini.

1
  • 1
    Thanks that did it. My path showed: /etc/php5/cgi/php.ini Commented Jun 29, 2012 at 0:08
6

For anyone else who may have arrived here looking for an answer but the accepted one didn't fit your case - I may have your solution!

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!

1
0

When I installed one package from AUR:

pecl_http

and I uncomment pecl_http PHP extension:

extension=http.so

in the file:

/etc/php/conf.d/http.ini

From this command:

php test.php

I got:

PHP Warning: Cannot load module 'http' because required module 'iconv' is not loaded in Unknown on line 0

Removing comment:

extension=iconv.so

in the file:

/etc/php/php.ini

solved the problem.

Linux distribution: Manjaro ( Arch Linux based ).

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.