pecl installs for previous php version

The solution was pretty simple. I had to make modifications to my pecl config. It turned out that these two command did the trick:

sudo pear config-set php_ini /etc/php.ini
sudo pecl config-set bin_dir /usr/bin/

pecl used the wrong phpize. There were two versions of the phpize. The same counts for my php.ini file.


In my case, I was attempting to install Gearman.

pecl install gearman would install it incorrectly.

php -i would show:

PHP Extension => 20100525

Yet pecl would install using:

PHP Api Version:         20090626

After changing my config settings to use:

First Fix

sudo pecl config-set php_ini /etc/php.ini
sudo pecl config-set php_bin /usr/bin/php5

I noticed that I would still get

WARNING: php_bin /usr/bin/php5 appears to have a suffix 5, but config variable php_suffix does not match

You can resolve this by using the config setting:

Additional Fix

sudo pear config-set php_suffix 5

Why was this a problem?

For me, I got into this problem because I added a custom PPA and reinstalled PHP. This meant that my previous install of php5-dev was out of sync.

You if you ever get into the same situation, you might just want to run..

apt-get remove php5-dev
pecl uninstall <extensionname>
apt-get install php5-dev
apt-get remove php5-pear
apt-get install php5-pear
pecl install <extensionname>

Alternatively, you can download the source and run phpize.