How to install PHP 5.6 as additional PHP-FPM & FastCGI for ISPConfig 3.1 on Ubuntu 16.04

This tutorial shows how to build PHP 5.6 as a PHP-FPM and a FastCGI version on Ubuntu 16.04 (Xenial Xerus). Ubuntu 16.04 ships with PHP 7 by default but there are still many websites out there that don't support PHP 7. This tutorial will show you how to install PHP 5.6 as additional PHP version on Ubuntu 16.04 so that you can switch between both versions for each website individually in ISPConfig.


1 Preliminary Note

I will install PHP 5.6 in /opt so that the main PHP 7 of Ubuntu is not affected and PHP 7 will stay the default PHP of our server while PHP 5.6 is available as option in ISPConfig (website settings). Please note that PHP-FPM can be used on both Apache and Nginx servers while FastCGI is available only for Apache servers in ISPConfig.

With older PHP versions, PHP-FPM and FastCGI had been mutually exclusive so that an FPM and FastCGI binary had to be build separately. With PHP 5.6, a single binary that supports FPM and FCGI mode can be build.


2 Compile PHP 5.6 with PHP-FPM and Fastcgi

Install the prerequisites to build PHP 5.6, wget and the nano editor that I will use to edit the config files:

apt-get install build-essential wget nano
apt-get install libfcgi-dev libfcgi0ldbl libjpeg62-dbg libmcrypt-dev libssl-dev libc-client2007e libc-client2007e-dev libxml2-dev libbz2-dev libcurl4-openssl-dev libjpeg-dev libpng12-dev libfreetype6-dev libkrb5-dev libpq-dev libxml2-dev libxslt1-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.6.30#


Download and extract PHP 5.6 from

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

Configure and build PHP 5.6.30 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/php-5.6.30 --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-gettext --with-xmlrpc --with-xsl --with-kerberos --enable-fpm

The above string is just one long command, do not add any line breaks. The last switch (--enable-fpm) makes sure this PHP version will work with PHP-FPM.

make install

Copy php.ini and php-fpm.conf to the correct locations:

cp /usr/local/src/php5-build/php-5.6.30/php.ini-production /opt/php-5.6.30/lib/php.ini
cp /opt/php-5.6.30/etc/php-fpm.conf.default /opt/php-5.6.30/etc/php-fpm.conf

Create the pool file directory php-fpm.d.

mkdir /opt/php-5.6.30/etc/php-fpm.d

Open /opt/php-5.6.30/etc/php-fpm.conf and adjust the following setting (remove the ; in front of the pid line):

nano /opt/php-5.6.30/etc/php-fpm.conf
pid = run/
user = www-data
group = www-data
listen =

2.1 Install xDebug extension (optional)

The xDebug module is a debugging extension for PHP. The installation is optional.

Install xDebug with these commands.

cd /opt/php-5.6.30/etc
pecl -C ./pear.conf update-channels
pecl -C ./pear.conf install xdebug

Then edit the php.ini file with an editor:

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

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


3 Create the systemd unit file

Ubuntu 16.04 uses systemd as init system. I will create a systemd unit file to be able to start / stop and restart the PHP-FPM service.

nano /lib/systemd/system/php-5.6.30-fpm.service

with the following content:

Description=The PHP 5.6 FastCGI Process Manager

ExecStart=/opt/php-5.6.30/sbin/php-fpm --nodaemonize --fpm-config /opt/php-5.6.30/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID


Enable the service and reload systemd:

systemctl enable php-5.6.30-fpm.service
systemctl daemon-reload

Finally start PHP-FPM.

systemctl start php-5.6.30-fpm.service

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

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

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


Test the PHP version:

cd /opt/php-5.6.30/bin
./php --version

The output should be similar to this screenshot.

4 Enable PHP 5.6 in ISPConfig

In ISPConfig 3.1, 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.6.30) - this PHP version will be listed under this name in the website settings in ISPConfig:

Add PHP 5.6 in ISPConfig

Go to the FastCGI Settings tab and fill out the fields as follows:

Path to the PHP FastCGI binary: /opt/php-5.6.30/bin/php-cgi
Path to the php.ini directory: /opt/php-5.6.30/lib

PHP-FCGI settings

Then g to the PHP-FPM Settings tab and fill out the fields as follows:

Path to the PHP-FPM init script: php-5.6.30-fpm
Path to the php.ini directory: /opt/php-5.6.30/lib
Path to the PHP-FPM pool directory: /opt/php-5.6.30/etc/php-fpm.d

PHP-FPM settings

Share this page:

Suggested articles

51 Comment(s)

Add comment


By: Gino Carpanetti D.

 Hello and thanks for the tutorial, worked perfect and i needed to add and older version of php to my ispconfig.

I'm having trouble with increasing the upload_max_filesize.

I changes the php.ini in opt/php-5.6.25/lib/php.ini wich is the location, acording to phpinfo(); from where the system is loading the configuration.

I change the parameter but nothing happens.

Bye and thanks

By: till

Did you restart php-fpm after you changed the php.ini?

systemctl restart php-5.6.25-fpm.service

By: Henning

On a fresh Ubuntu 16.04 I used the automated install for ISPConfig with Nginx. Then I used this tutorial. After creating a website and assigning the additional php version (5.6.25) I receive error 502. The log for the site says the following:

2016/10/09 08:08:22 [crit] 3906#3906: *5 connect() to unix:/var/lib/php7.0-fpm/web1.sock failed (2: No such file or directory) while connecting to upstream, client:, server:, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php7.0-fpm/web1.sock:", host: ""

So it seems php 5.6 is not used. However I the whole process several times and I am pretty sure I obeyed every single step. Do you have any suggestion where to look to get it running?

By: Rafael

 Hi Henning, I'm having a similar issue.. did you solved it?

By: Henning

Please remove my former comment. I had a typo in the path to php-fpm.conf. I apologize for not being careful enough...

By: Marian

Hello. Thanks a lot for this useful tutorial, I follow step by step instructions and the magic happends, now I have php 7 and php 5.6.25 available (on Ubuntu server 16.04 with ISPConfig). Very useful and understandable tutorial.

By: Rafael Santana

IS working in debian 8?

By: Luis Muzquiz

How can i connect apache2 and libapache2-mod-fastcgi to this php-fpm 5.6 without step 4 (without enabling PHP 5.6 in ISPConfig). Is there another way to enable php-fpm?

I get the correct result when using: ./php --version but how can i get php version just using php -v?

By: pete


wonder if you could help, i am on ubuntu 16.04lts with php 7 using ispconfig 3.1

when i configure i get this error

configure: error: Kerberos libraries not found.

      Check the path given to --with-kerberos (if no path is given, searches in /usr/kerberos, /usr/local and /usr )

any clues ?

By: GRaham

When I run your tutorial eveerything seem to work fine up to the make install (which seems to work OK) but then there is nothing in the following directory "/opt/php-5.6.25"...what  have I missed???


By: Norheim

found a solution ?

By: Lukasz

Hello, someone know how to enable that config in pure Apache2 (without ISPConfig) ?

By: Wieger Klijnstra

After following the steps carefully there is no extra PhP version available in the ISPConfig3 frontend under the selected site. Still only the "default" option is visible when Fast_CGI is selected. Can I manually add this somewere in a config file so it is showing up?  Or can I force a specific website to use PhP version 5.6 instead of PhP7? 

By: Wieger Klijnstra

Solved : Login in as client and the PhP selection. Still I have a problem with a ereg function deprecated error in one of the scripts. I even need to downgrade PhP to version a version lower tah 5.3.0


By: Markus

It works, thanks for the tutorial.

But it doesnt recognize my zend_extension line for the ioncube loader:

zend_extension = /opt/php-5.6.25/lib/php/extensions/no-debug-non-zts-20131226/

I put it into the /opt/php-5.6.25/lib/php.ini file, and also tried it to put it into the domain specific options (the stuff that is saved in /var/www/conf/____ when it is in the textarea field in ISPconfig)

Does somebody know why it cant load the IONcube loader?

In the PHP7 ini, the IONcube loader works without problems!

By: thctlo

To bad we need to compile things, because who is notifying who about security updates now.

So I preffer :  ( this one allows multiple php versions installed )

But is that also possible when useing ispconfig and php5.6 with php7.0


By: Mosa

I was not able to get PHP-FPM to work until I copied the Path to the PHP-FPM init script

by following this  hope this help some as

By: Alberto Guzman

I suppose it is possible to run simultaneously php-5.6 & 7.1, but i wonder if does it need some change on the configuration for systemd so they don't get mixed of mutually excluded or something alike?

By: Alberto Guzman

I migh be wrong but seems to me that the option


is missing, but called to php.ini later on the installation, is that an error or that's some new behaivor?

By: Kyrill

Can anyone confirm that this still works? I installed it just fine back in March but today on a new server i am getting a ton of errors when trying to configure php.

By: Elring

Yes, it still works (successfully installed PHP 5.6.31 today). I just omit --with-imap and --with-imap-ssl ...

By: Peter

having problem with pictures in jpeg like imagecreatefromgif

By: Ricardo

I'm facing strange behavior trying to crop images...

By: Jaume

Hi, i've done the process, all ok but I can't see the option in the domain edit, between PHP: and "Web server config:" options, where is it? is there a way to enable/disable?


By: Alex


Unfortunately configure stops:

checking whether rfc822_output_address_list function present ... no

checking whether build with imap works ... no

configure: error: build test failed. Please check the config.log for details.

By: Uvigii

Great tut!

I would go for:mkdir /opt/php-5.6 and ./configure --prefix=/opt/php-5.6to simplify future php updates.

By: jcmoinel

hello ! is it possible to make the same tuto but for Ubuntu 17.04 Zesty ? i have a problem with :

thank you !!


By: Ruben

You did my day. First complex tutorial that works 100% perfectly from the first to the last line. REALLY THANK YOU!!! Problem solved. 

By: William

 help me; thanks for the tutorial

 can not connect with mysql used php v 5.6.30 and with php7 i can connect. config ispconfig3 for used php 5.6.30?

By: Sam

How do you enable php extensions like "intl" for this?

By: tiger nak

Installation failed from the beginning for ubuntu 17.04 with php 7 with this tutorial:

First error messages: E: Package 'libpng12-dev' has no installation candidate

Followed by other error.

Any help appreciated.


By: John Fiduci

Hi Till, Do you have any plans to make a "Debian Stretch" version of this manual...? Would help a lot ! Thanks. (And thanks for all the great work on this HowTo site !).

By: John Fiduci

P.S. I did, by the way, try and use this Ubuntu-manual on Debian. But sadly it fails. I get missing libraries libjpeg62-dbg and libpng12-dev during compile. I then tried installing these packages manually first (from Wheezy archives), but then my "make" still fails...

By: Kamil

Hello, how add memcache extension to this php?

By: bkraul

You add it by installing the latest pecl package for php 5.6 (4.0.11 at this time). (I am using php 5.6.32 so change the cd command to your version).

cd /opt/php-5.6.xx/etc

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

By: burak

Hi, thx for detailed tutorial, i just want to ask that how can i install zeromq only on this additional php 5.6.30 ? 

By: rodvazco

Hi till, same problema here, fails on ubuntu 17


when starting fresh and you want to setup metronome, don't forget to do

$sudo apt-get install build-essentials


pecl setup of xdebug doesn't seem to work ( fetching too new version which requires php 7.0+ )

cd /tmp/ mkdir xdebug cd xdebug/ wget tar xf xdebug-2.5.5.tgz cd xdebug-2.5.5 /opt/php-5.6.30/bin/phpize ./configure --with-php-config=/opt/php-5.6.30/bin/php-config make make install

By: Óscar M.

How can I install the extension?

I can't find any information.

By: Crealosophy

A lot went wrong for me with Ubuntu 18.04 and php 7.2 installed.

* libjpeg62-dbg and libpng12-dev do not work, but you will get the name of the replacement for jpeg and for png it is just libpng-dev

* I had to symlink curl (same way was lib-client)

* php 5.6 is not compatible with OpenSSL 1.1, which leads to errors when executing "make". Fortunately, there is a guy who made backport changes:

* Then I got an error on maxing out virtual memory, due to some libmagic/apprentice.c building. has the solution: (just add --disable-fileinfo to ./configure)

By: Björn

After upgrading from 16.04 to 18.04 we get errors:


[email protected]:/opt/php-5.6.30/bin# ./php --version./php: /usr/lib/x86_64-linux-gnu/ version `CURL_OPENSSL_3' not found (required by ./php)


What we have to do? Included versions should work like before.

By: levien

Hi Till, will there be un update tutorial for installing PHP 5.6 in ispconfig3 on ubuntu 18.04?

Because as mentioned below, there are some differences between 16.04 and 18.04....what will fails the install.

By: till

For Ubuntu 18.04, I would just use the precompiled packages from Ondrej repository. Just ensure to switch back the default php version with the update-alternatives command to the one that ships with Ubuntu 18.04 for php-cli and php-fpm after you installed the packages from Ondrej repo.

By: Levien

Ok then, i will wait until there is a tutorial for ispconfig 3 with ubuntu 18.04 for installing old PHP 5.6 because i work with a production server and don't want to risk any problems.

By: Bastian

Thanks for the tutorial and thanks for working on ISPConfig.


I have the following problem: under php-fcgi-scripts/ is created nonsense after I saved the page with PHP: Fast-CGI and the correct version. The created folder has the name web90 I would have expected web121 in the file .php-fcgi-starter the paths do not exist. The clientID does not match web90 or web121.


In the .vhost under /etc/apache2/sites-available the FCGI part is missing, which is then in the .vhost.err. This is probably just a symptom of the problem with the .php-fcgi-starter script.


Someone an idea or something ever seen?


What else can I say:

The server has been updated from ISPConfig 2 to version 3 some years ago. The server has also been migrated to new hardware before, where I have basically kept to this tutorial: 10804 /

By: till

Please post in the ISPConfig forum here at howtoforge if you need help with your setup.

By: Romeo

When can you make a tutorial for Ubuntu version 18.04? Please!


Same question on LEMP Ubuntu 18.04.

By: Dave Harris

HiAs usual, Till, thanks for an excellent tutorial which I will shortly be using. However, I have a problem trying to configure an Ubuntu 16.04 server running ISPConfig 3 with PHP 7 (system default) and PHP 5.5.3, required for a couple of ancient websites. I have followed one of your other multi-PHP tutorials, adjusting for version numbers as required and all has gone well. Except that even if I set a website to use the alternative PHP - 5.5.3 in this case, a PHPInfo on the site shows it running 7. Any ideas? Any useful info I could provide?

By: Dave Harris

I need t install 5.6 on Ubuntu 18.04. Unfortunately, the normal released versin will not compile as the version of OpenSSL provided with 18.04 is not compatible with 5.6. However, there is a forked version of 5.6, here, which has had the PHP OpenSSL module changes backported.But: it seems to be missing files such as "configure"! Is this a feature of downloading a forked package from Github or am I missing something?I have the original 5.6.32, so I could run a diff of the changed modules and backport those into the original 5.6.32 (which has no missing files)... or simply copy the changed files across.Any ideas very welcome :)

By: Fira

Hi , thanks for an excellent tutorial. However, I have a problem trying to configure an Debian server running ISPConfig 3 with PHP 5.4.39 (system default) and PHP 7, required for a couple of websites. I have followed one of your other multi-PHP tutorials, adjusting for version numbers as required and all has gone well. Except that even if I set a website to use the alternative PHP 7 - in this case, a PHPInfo on the site shows it running  5.4.39.