I've tried it a 100 times I'm really new to Ubuntu and ended with a bunch of error that I don't even understand can any one please help me??

Here is what I did:

  1. I installed PHP
  2. I installed libcurl then php5-dev
  3. I tried installing PECL extension and it says PHPIZE not found.
  • Welcome to Ask Ubuntu. Can please give us the full command you issued and the full error message. Edit your question text to add the information please.
    – MadMike
    Jan 10, 2014 at 9:46

4 Answers 4


First, you will need to install PEAR via apt-get to get the necessary package and distribution system that both PEAR and PECL use. From a shell prompt enter:

sudo apt-get install php-pear

You will be prompted to confirm the install. Just press “y” and enter. If all goes well you should see it download and install the php-pear package.

Now you will need to install the php5-dev package to get the necessary PHP5 source files to compile additional modules. Enter the following from a shell prompt:

sudo apt-get install php5-dev

If you do not install the php5-dev package and try to install a PECL extension using “pear install”, you will get the following error:

sh: phpize: not found
ERROR: `phpize’ failed

The PECL_HTTP extension requires an additional dependency package to be installed. You can probably skip this for other extensions:

sudo apt-get install libcurl3-openssl-dev

Now we are finally ready to actually install the extension. From a shell prompt enter following but substitute “pecl_http” with the PECL extension name you are installing:

sudo pecl install pecl_http

The installer may ask you about some specific options for the extension you are installing. You can probably just hit enter one or more times to accept all the defaults unless you want to set specific options for your implementation. If all goes well, the module should download, build, and install.

Once the install is complete, it will probably ask you to add a “extension=” line to your php.ini file. Open up the php.ini file in your favorite text editor and add the line under the section labeled “Dynamic Extensions”. On Ubuntu the php.ini file seems to be located in the /etc/php5/apache2 folder:

sudo nano /etc/php5/apache2/php.ini

In this example, the pecl_http extension install asked me to add “extension=http.so”. Now that the php.ini file has been updated, Apache will need to be restarted so the new extension will be loaded:

sudo /etc/init.d/apache2 restart 


  • these were the same steps i followed exactly(from the same source) still no joy :/ i moved to Ubuntu just for some extensions that are not available on windows but this is so confusing because i'm new at this.
    – maniteja
    Jan 10, 2014 at 10:17
  • 1
    PLEASE NOTE: You might need to install make before doing this. Simply do sudo apt-get install make
    – Tomanow
    Mar 29, 2014 at 9:31
  • 5
    If you're using PHP7, you'll want the php7.0-dev package instead: sudo apt-get install php7.0-dev Sep 8, 2016 at 9:06

In addition to @Ask's answer I also needed to do:

sudo apt-get install libpcre3-dev

before running pecl install pecl_http because I was getting this error about pcre.h:

fatal error: pcre.h: No such file or directory compilation terminated.

Also, instead of editing the php.ini file I created a new file called pecl-http.ini in the conf.d subdirectory of where the php.ini file was, ( on ubuntu /etc/php5/apache2/conf.d )

And I needed to add in three lines:


Finally, since this installed version 2.0.6 I couldn't use the http_get_request_headers function but needed to instead use the namespaced version, \http\Env::getRequestHeader() see more details here

ps: don't forget to restart apache when you're done ( service apache2 restart )

  • Good call; wish I'd read your answer before I went off hunting for libcre-dev. I should also add that in my case I needed to add extension=json.so before the http.so line despite already having the json.ini file included in conf.d.
    – M1ke
    Dec 2, 2014 at 12:10

In addition to the answers of Maythux and cwd, you might not want to edit your php.ini file because these changes might get lost on updates.

Debian (and thus Ubuntu) handles php modules in same way like apache modules. Have a look at /etc/php5, you will find directories like this:


When you look into mods-available you see several files like:


To enable/disable these available mods for all APIs (apache, cli, cgi) you can just use the commands php5enmod or php5dismod like so:

$ sudo php5enmod curl


$ sudo php5dismod curl

These will create (or remove) symbolic links to the module config file in apache2/conf.d/ and cli/conf.d/.

You can also specify the sapi to enable/disable the mod for (apache in this case):

$ sudo php5enmod -s apache2

pecl install might not create a configuration file for raphf (and other modules installed with it) but you can create it on your own:

$ sudo touch /etc/php5/mods-available/raphf.ini

Then write in the following lines:

; configuration for php raphf module
; priority=20

The default priority is 20. It might depend on the type of the module which priority you have to use. For raphf 20 seems fine. (Update: if you're looking for pecl_http, as of version 2 it has to be loaded after rapfh and propro, so set the priority in the mods-available/http.ini to 30.)

With that you can enable the module:

$ sudo php5enmod raphf

(Note: my answer depends on Ubuntu 14.04 but might work in an equal manner for 13.04, see http://www.lornajane.net/posts/2012/managing-php-5-4-extensions-on-ubuntu )


Now days, install PEAR this way, to get it from the source:

wget http://pear.php.net/go-pear.phar
php go-pear.phar

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .