Installing PHP extensions for phpfarm

When using several PHP installations with phpfarm, installing PHP extensions is not always easy - mostly because Pyrus is very strict about package files - and many of the packages in PECL unfortunately have invalid non-validating package.xmls.

Getting the package

While you can download the tgz manually, you can use an existing PEAR installation to get it:

$ cd /opt/phpfarm/
$ pear download pecl/xdebug
downloading xdebug-2.1.1.tgz ...
Starting to download xdebug-2.1.1.tgz (303,198 bytes)
..............................................................done: 303,198 bytes
File /opt/phpfarm/xdebug-2.1.1.tgz downloaded
$ tar xzvf xdebug-2.1.1.tgz
...

Installation

The two things to remember are to use the correct phpize and php-config for the specific PHP version:

$ cd xdebug-2.1.1
$ /opt/phpfarm/inst/bin/phpize-5.3.6
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
configure.in:3: warning: prefer named diversions
configure.in:3: warning: prefer named diversions
$ ./configure --with-php-config=/opt/phpfarm/inst/bin/php-config-5.3.6
...
$ make
...
$ make install
...

You need to enable the extension in your php.ini file now. Find its location with /opt/phpfarm/inst/bin/php-5.3.6 --ini.

If you installed xdebug, add zend_extension=/full/path/to/xdebug.so. Most others need just extension=xhprof.so - and make sure that extension_dir is set.

Written by Christian Weiske.

Comments? Please send an e-mail. Or Reply or Like.