Ubuntu. Installing Extensions for PHP 5.3
Continuing the topic of installing PHP 5.3 on Ubuntu, I’ll describe how to install some PHP extensions. I was asked to do this and sent a list of extensions, but I also use some of these extensions every day, so they should come in handy for you too.
Building session support
You can specify --enable-session when building PHP:
./configure --enable-session
Or build it separately, for example, after installation:
cd php_5_3_fpm/ext/session
phpize
./configure
make && make install
Installing MySQL and MySQLi
MySQL and MySQLi can be built in two ways, just like session support. The first is while building PHP:
./configure --with-mysql=/usr/bin/mysql_config --with-mysqli=mysqlnd
Here I built both extensions during PHP installation
The second is to build them after installation:
cd php_5_3_fpm/ext/mysql
phpize && ./configure && make && make install
cd php_5_3_fpm/ext/mysqli
phpize && ./configure && make && make install
Installing IMagick
Choose a suitable version from http://pecl.php.net/package/imagick; I used the latest one.
apt-get install libmagickwand-dev
cd /tmp
wget http://pecl.php.net/get/imagick-3.0.0RC1.tgz
tar -xzvf imagick-3.0.0RC1.tgz
cd imagick-3.0.0RC1
phpize
./configure
make && make install
Installing GD
cd php_5_3_fpm/ext/gd
phpize
./configure
make && make install
Installing cURL
apt-get install libcurl3-dev
cd php_5_3_fpm/ext/curl
phpize
./configure
make && make install
Installing mcrypt
cd php_5_3_fpm/ext/mcrypt
phpize
aclocal
./configure
make && make install
Installing SphinxClient
wget http://www.sphinxsearch.com/downloads/sphinx-1.10-beta.tar.gz
tar -xzf sphinx-1.10-beta.tar.gz
cd sphinx-1.10-beta
cd ./api/libsphinxclient/
./buildconf.sh
./configure && make install
If you get errors like:
sphinxclient.c:1356: error: ‘SO_NOSIGPIPE’ undeclared (first use in this function)
then here are some instructions: http://www.sphinxsearch.com/bugs/view.php?id=550. There is a patch there that you need to apply to sphinx-1.10-beta/api/libsphinxclient/sphinxclient.c.
Installing DOM
cd php_5_3_fpm/ext/dom
phpize
./configure
make && make install
Installing JSON
cd php_5_3_fpm/ext/json
phpize
./configure
make && make install
Installing mbstring
cd php_5_3_fpm/ext/mbstring
phpize
./configure
make && make install
Installing iconv
cd php_5_3_fpm/ext/iconv
phpize
./configure
make && make install
Installing gettext
cd php_5_3_fpm/ext/gettext
phpize
./configure
make && make install
Installing PCRE
./configure --with-pcre-regex=DIR
Installing SOAP
./configure --enable-soap
or
cd php_5_3_fpm/ext/soap
phpize
./configure
make && make install
Installing Memcached
Download the latest extension from here: http://pecl.php.net/package/memcached.
wget http://pecl.php.net/get/memcached-1.0.2.tgz
tar xzvf memcached-1.0.2.tgz
cd memcached-1.0.2
phpize
./configure --with-libmemcached-dir=DIR
make && make install
Installing PHPRedis
Download the extension from here: http://github.com/owlient/phpredis/downloads.
wget -O owlient-phpredis-1.2.0.tgz http://github.com/owlient/phpredis/tarball/1.2.0
tar xzvf owlient-phpredis-1.2.0.tgz
cd owlient-phpredis-2675d15
./configure
make && make install
Installing xDebug
Go here: http://xdebug.org/download.php and download the extension you need.
wget http://xdebug.org/files/xdebug-2.1.0.tgz
tar xzvf xdebug-2.1.0.tgz
cd xdebug-2.1.0
./configure
make && make install
Next, check the documentation for version 2 and visit the page on configuring PHP to use xDebug.
Installing BCMath
cd php_5_3_fpm/ext/bcmath
phpize
./configure
make && make install
Installing runkit
Go to the download page for the runkit PECL extension, choose the latest version, and download it.
wget http://pecl.php.net/get/runkit-0.9.tgz
tar xzvf runkit-0.9.tgz
cd runkit-0.9
phpize
./configure
make && make install
Installing parsekit
Go to the download page for the parsekit PECL extension, choose the latest version, and download it.
wget http://pecl.php.net/get/parsekit-1.3.0.tgz
tar xzvf parsekit-1.3.0.tgz
cd parsekit-1.3.0
phpize
./configure
make && make install
One last thing
Don’t forget to add the modules to php.ini, for example:
; ...
extension=gd.so
extension=xdebug.so
; ...
Comments are closed. Read the original discussion in Russian →
