How To Build PHP 5.5 (PHP-FPM & FastCGI) With ionCube Loader, Zend OPcache And APCu For ISPConfig 3 (Debian Wheezy) - Page 2

3 Building PHP 5.5.7 (FastCGI)

Download and extract PHP 5.5.7:

mkdir /opt/phpfcgi-5.5.7
mkdir /usr/local/src/php5-build
cd /usr/local/src/php5-build
wget -O php-5.5.7.tar.bz2
tar jxf php-5.5.7.tar.bz2

cd php-5.5.7/

Install the prerequisites for building PHP5:

apt-get install build-essential

apt-get build-dep php5

apt-get install libfcgi-dev libfcgi0ldbl libjpeg62-dbg libmcrypt-dev libssl-dev libc-client2007e libc-client2007e-dev

ln -s /usr/lib/libc-client.a /usr/lib/x86_64-linux-gnu/libc-client.a

(The last command is needed if you build PHP with --with-imap, because otherwise ./configure will stop with the following error:

checking for crypt in -lcrypt... yes
configure: error: Cannot find imap library (libc-client.a). Please check your c-client installation.
[email protected]:/usr/local/src/php5-build/php-5.5.7#


Configure and build PHP 5.5.7 as follows (you can adjust the ./configure command to your needs, take a look at

./configure --help

to see all available options; if you use a different ./configure command, it is possible that additional libraries are required, or the build process will fail):

./configure \
--prefix=/opt/phpfcgi-5.5.7 \
--with-pdo-pgsql \
--with-zlib-dir \
--with-freetype-dir \
--enable-mbstring \
--with-libxml-dir=/usr \
--enable-soap \
--enable-calendar \
--with-curl \
--with-mcrypt \
--with-zlib \
--with-gd \
--with-pgsql \
--disable-rpath \
--enable-inline-optimization \
--with-bz2 \
--with-zlib \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-pcntl \
--enable-mbregex \
--enable-exif \
--enable-bcmath \
--with-mhash \
--enable-zip \
--with-pcre-regex \
--with-mysql \
--with-pdo-mysql \
--with-mysqli \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--enable-gd-native-ttf \
--with-openssl \
--with-fpm-user=www-data \
--with-fpm-group=www-data \
--with-libdir=/lib/x86_64-linux-gnu \
--enable-ftp \
--with-imap \
--with-imap-ssl \
--with-kerberos \
--with-gettext \
--with-xmlrpc \
--with-xsl \
--enable-opcache \

The last switch (--enable-cgi) makes sure this PHP version will work with FastCGI.

make install

Copy php.ini to the correct location:

cp /usr/local/src/php5-build/php-5.5.7/php.ini-production /opt/phpfcgi-5.5.7/lib/php.ini

To enable the Zend OPcache, open /opt/phpfcgi-5.5.7/lib/php.ini...

vi /opt/phpfcgi-5.5.7/lib/php.ini

... and add the following line at the end:


That's it - if you like, you can now install some additional modules like APCu, memcache, memcached, and ioncube.

The APCu, memcache, and memcached modules can be installed through PEAR which we must install and initialize first:

apt-get -y install php-pear

cd /opt/phpfcgi-5.5.7/etc

pecl -C ./pear.conf update-channels

APCu can now be installed as follows:

pecl -C ./pear.conf install channel://

Accept all default values. Afterwards, open /opt/phpfcgi-5.5.7/lib/php.ini...

vi /opt/phpfcgi-5.5.7/lib/php.ini

... and add the line at the end of the file (you can also configure some additional APCu settings):

;apc.shm_segments = 5

The memcache extension can be installed as follows:

pecl -C ./pear.conf install memcache

Open /opt/phpfcgi-5.5.7/lib/php.ini...

vi /opt/phpfcgi-5.5.7/lib/php.ini

... and add the line at the end of the file:


The memcached extension can be installed as follows:

apt-get install libmemcached-dev

pecl -C ./pear.conf install memcached

Open /opt/phpfcgi-5.5.7/lib/php.ini...

vi /opt/phpfcgi-5.5.7/lib/php.ini

... and add the line at the end of the file:


Since January 3, the ionCube loader is available for PHP 5.5. The ionCube Loader can be installed as follows:

cd /tmp

Next download and unpack the correct ionCube Loader package for your architecture (x86_64 or x86).

For x86_64:

tar xfvz ioncube_loaders_lin_x86-64.tar.gz

For x86:

tar xfvz ioncube_loaders_lin_x86.tar.gz

Proceed as follows:

cp ioncube/ /opt/phpfcgi-5.5.7/lib/php/extensions/no-debug-non-zts-20121212/
vi /opt/phpfcgi-5.5.7/lib/php.ini

Add the line zend_extension = /opt/phpfcgi-5.5.7/lib/php/extensions/no-debug-non-zts-20121212/ right at the beginning of the file (before the [PHP] line):

zend_extension = /opt/phpfcgi-5.5.7/lib/php/extensions/no-debug-non-zts-20121212/

In ISPConfig 3.0.5, you can configure the new PHP version under System > Additional PHP Versions. On the Name tab, you just fill in a name for the PHP version (e.g. PHP 5.5.7) - this PHP version will be listed under this name in the website settings in ISPConfig:

Go to the FastCGI Settings tab (the PHP-FPM Settings tab can be left empty) and fill out the fields as follows:



About The Author

Falko Timme is the owner of nginx WebhostingTimme Hosting (ultra-fast nginx web hosting). He is the lead maintainer of HowtoForge (since 2005) and one of the core developers of ISPConfig (since 2000). He has also contributed to the O'Reilly book "Linux System Administration".

Share this page:

1 Comment(s)

Add comment



If your having some problems compling try using these works perfect for me. The differances are --with-libdir=lib64 & --with-openssl=/usr
For CGI use this:

 ./configure --prefix=/opt/phpfcgi-5.5.7 --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --with-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-pdo-mysql --with-mysqli --with-jpeg-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-openssl=/usr --with-fpm-user=www-data --with-fpm-group=www-data --with-libdir=lib64 --enable-ftp --with-imap=/usr --with-imap-ssl --with-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-cgi

 For FPM

 ./configure --prefix=/opt/php-5.5.7 --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --with-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-pdo-mysql --with-mysqli --with-jpeg-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-openssl=/usr --with-fpm-user=www-data --with-fpm-group=www-data --with-libdir=lib64 --enable-ftp --with-imap=/usr --with-imap-ssl --with-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-fpm