Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

First I installed the curl extension for PHP:

$ sudo pacman -S php-curl


$ grep curl /etc/php/php.ini

Then I installed the PHP PEAR

$ sudo pacman -S php-pear

Having now installed pear, I have also installed PECL, and should now be able to install the php_http extension.

$ pecl install php_http


$ grep http.so /etc/php/php.ini

The http.so is found in the folder /usr/lib/php/moduels/ and latter copied to the folder /usr/lib/http/modules/ .

Now, as far as I know, this should have installed the php_http extension, but when I try to

$req = new HttpRequest();

I get the error

Fatal error: Class 'HttpRequest' not found in /srv/http/webcrawler/nettocrawl.php on line 4 
share|improve this question
Looks like HTTP_Request has its own pear package. Is it installed already? – Stéphane Gimenez Aug 17 '11 at 14:30
up vote 1 down vote accepted


The latest version of pecl_http introduces the http namespace. so HttpRequest will no longer be available. Follow php's documentation for using namespace, and checkout the supplied phpunit directory for usage & examples.

$req = new http\Client\Request();

Or a more preferred way, that allows for backwards support

use http\Client\Request as HttpRequest;
$req = new HttpRequest();


Sometimes PECL extensions might not get installed correctly. This can happen if your mixing pacman packages and pecl extensions, but it's very rare. I recommend installing pecl_http by hand.

Grab source

shell ~> curl -o pecl_http.tar.gz http://pecl.php.net/get/pecl_http
shell ~> tar zvxf pecl_http.tar.gz
shell ~> cd pecl_http

Configure, Compile, and Test

shell ~/pecl_http> phpize
shell ~/pecl_http> ./configure
shell ~/pecl_http> make
shell ~/pecl_http> make test


shell ~/pecl_http> make install

This will output the directory http.so will be installed. In my case, it's /usr/lib/php/<timestamp>/. A helpful note.

php.ini & Test

Edit php.ini file, and add the http.so extension.

shell ~> php -m | grep http

If http is not displayed, re-edit the php.ini, and the extensions full path;

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.