How To Use Multiple PHP Versions (PHP-FPM & FastCGI) With ISPConfig 3 (Debian Wheezy) - Page 2

3 Building PHP 5.3.22 (FastCGI)

Download and extract PHP 5.3.22:

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

cd php-5.3.22/

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.


Configure and build PHP 5.3.22 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.3.22 \
--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 \

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.3.22/php.ini-production /opt/phpfcgi-5.3.22/lib/php.ini

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

The APC, 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.3.22/etc

pecl -C ./pear.conf update-channels

APC can now be installed as follows:

pecl -C ./pear.conf install apc

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

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

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

;apc.shm_segments = 5

The memcache extension can be installed as follows:

pecl -C ./pear.conf install memcache

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

vi /opt/phpfcgi-5.3.22/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.3.22/lib/php.ini...

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

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


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.3.22/lib/php/extensions/no-debug-non-zts-20090626/
vi /opt/phpfcgi-5.3.22/lib/php.ini

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

zend_extension = /opt/phpfcgi-5.3.22/lib/php/extensions/no-debug-non-zts-20090626/

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.3.22) - 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:

Share this page:

17 Comment(s)

Add comment


From: Normen Marienfeld at: 2013-03-23 12:05:06

Hallo zusammen,

Habe alles so gemacht wie im Tutorial beschrieben bleibe aber leider hängen bei:

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

configure: error: Cannot find imap library (libc-client.a). Please check your c-client installation.

 x86_64-linux-gnu existiert bei mir gar nicht ?

was kann ich da machen ?



Debian 6.0 (Squeeze)


From: at: 2013-03-24 14:00:49

Wheezy uses different /lib /lib64 structure than Squeeze does.

 You might need to use --with-libdir=lib64 instead.

 See for Squeeze compatible ./configure.

From: Anonymous at: 2013-09-08 19:41:21


 i have two WHEEZY machines one is with SID and other with stable repositories and both systems have /usr/lib/x86_64-linux-gnu/ folder.

I don't know why your WHEEZY does not contain this folder:

Ask by debian or find this directory and set it in --with-libdir= option.


From: likufanele at: 2013-12-25 15:53:27

For Wheezy x32 bit you have to change the configure line from

--with-libdir=/lib/x86_64-linux-gnu \


--with-libdir=/lib \

From: Peterb at: 2013-05-11 11:26:06

these instructions have an error.

This line does not work

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

After searching the directories, x86_64-linux-gnu does not exist.

The error is ln: filed to create symbolic link

libc-client.a   no such file


From: Evil Kitten at: 2013-06-12 08:52:56

Hello, was doing the same with new 5.3.26 and got the error
 configure: error: xml2-config not found. Please check your libxml2 installation.
 had to install  libxml2-dev to fix it.

From: Brian at: 2013-09-24 21:03:38

when I run the step When I use "Make" then Make Install, (Installing PHP-5.3.3). in the console show me this error

 ext/openssl/xp_ssl.o: In function `php_openssl_setup_crypto':                                                              

/usr/local/src/php5-build/php-5.3.3/ext/openssl/xp_ssl.c:353: undefined reference to `SSLv2_server_method'                 

/usr/local/src/php5-build/php-5.3.3/ext/openssl/xp_ssl.c:333: undefined reference to `SSLv2_client_method'                 

collect2: error: ld returned 1 exit status                                                                                 

make: *** [sapi/fpm/php-fpm] Error 1                                                                                       

root@server php5-build/php-5.3.3#



 How i Can solve this?

From: Julien Meyer at: 2013-12-05 15:31:30


I had the same problem. It's a bug

Apply the patch debian_patches_disable_SSLv2_for_openssl_1_0_0.patch and it will work. 


From: Anonymous at: 2014-05-13 00:11:01

For me show this error.
checking whether libmemcached supports sasl... no
configure: error: no, libmemcached sasl support is not enabled. Run configure with --disable-memcached-sasl to disable this check
ERROR: `/tmp/pear/temp/memcached/configure --with-libmemcached-dir=no' failed

From: Daniele at: 2014-09-17 22:51:24

i have same problem....

and i unable to install 


checking whether libmemcached supports sasl... no
configure: error: no, libmemcached sasl support is not enabled. Run configure with --disable-memcached-sasl to disable this check
ERROR: `/tmp/pear/temp/memcached/configure --with-libmemcached-dir=no' failed

there is not a workaround?????

From: at: 2014-11-07 18:01:35

In installed memcached like this:

cd /tmp

pecl download memcached-${pecl_memcached_ver}
tar xzvf memcached-${pecl_memcached_ver}.tgz
cd memcached-${pecl_memcached_ver}/
./configure --disable-memcached-sasl --with-php-config=/opt/php-5.3.29/bin/php-config

make install

cd ..
rm -r memcached-${pecl_memcached_ver}

nano /opt/php-5.3.29/lib/php.ini


/etc/init.d/php-5.3.29-fpm reload


From: at: 2014-06-09 21:11:57

There was an error in dns.c

error: undefined reference to '__dn_expand'


Add " -lresolv" to EXTRA_LIBS in Makefile.


From: Anonymous at: 2014-08-12 18:44:01

Compiling php 5.3.28 on debian jessie (testing) does not work without some changes.
First, freetype.h was not found. In line 32280 I removed

 if test -f "$i/include/freetype2/freetype/freetype.h"; then

 and added

 if test -f "$i/include/freetype2/freetype.h"; then

After that freetype.h was found.


checking whether build with IMAP works... no
configure: error: build test failed. Please check the config.log for details.

To solve that error I had to add /usr as path for --with-openssl and --with-imap:
--with-openssl=/usr --with-imap=/usr

From: at: 2013-05-31 19:34:25

Just tips after my installation:

Skip lines:

--with-fpm-user=www-data \
--with-fpm-group=www-data \
(this is example for fcgi and configure returns error)

also skip
-with-libdir=/lib/x86_64-linux-gnu \
or configure gets error about mysqclient
without this line you can also skip
ln -s /usr/lib/libc-client.a /usr/lib/x86_64-linux-gnu/libc-client.a
and there is no problem with imap when ./configure

From: at: 2013-05-31 17:11:22

I'm getting this error afer ./configure

checking for specified location of the MySQL UNIX socket... no
configure: error: Cannot find libmysqlclient under /usr.
Note that the MySQL client library is not bundled anymore!

Trying to compile on squeeze..

From: Kenny at: 2013-09-22 21:04:32

I got errors when starting the init scripts for the FPM versions, and realized I had no var/run and var/log in my PHP directories under /opt, so I had to create them manually.  Also, I tried 8999 and 8998, which I think were the ones it said to try if I remember correctly, but neither worked, it said ports not available.  After some trial and error, I ended up using 8995 for 5.3.22 and 8991 for 5.4.12.  I did not have these issues at all with the Ubuntu 13.04 version, although I've chosen to use Debian in the end because ISPConfig is a more solid setup there.  I have yet to set these up within ISPConfig or install the FastCGI versions, but otherwise all is well despite those issues.  Very helpful tutorial, thank you very much.

From: mustafa at: 2015-02-19 09:22:54

For  FastCGI is this line necessary?

--with-fpm-user=www-data \ --with-fpm-group=www-data \