PHP 7.2 with Debian 9 stretch on ISPConfig, because Security Updates ended 03.12.2018 for PHP 7.0

Hi Folks,

because of the reason security updates ended 03.12.2018 for PHP 7.0, I was looking for an update to 7.1 or even better 7.2.
I was thinking to run 2 or more version parallel to check each website could handle PHP 7.2. and if need, I would be able to switch back to 7.0.
So I do not find an out of the box solution so we have to do some small steps.
First of all the Debian default packages only include 7.0 so I have to look around for possible package hosts to handle the PHP 7.2. packages.
I found a good one and I want to use:

So there is a README under the URL where you can find a small bash script to enable and activate the new PHP versions:

if [ "$(whoami)" != "root" ]; then
${SUDO} apt-get -y install apt-transport-https lsb-release ca-certificates
${SUDO} curl -ssL -o /etc/apt/trusted.gpg.d/php.gpg
${SUDO} sh -c 'echo "deb $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
${SUDO} apt-get update

So then we will be able to install PHP 7.2 and as many modules as you need. For me a good setup was the following:

apt install php7.2 php7.2-cli php7.2-cgi php7.2-fpm php7.2-mysql php7.2-mbstring php7.2-zip php7.2-odbc php7.2-recode php7.2-xml php7.2-intl php7.2-gd php7.2-curl php7.2-bcmath php7.2-bz2

After that we have PHP 7.2 installed but as default version and that is not what we want to have we want 7.0 as default and 7.2 as an option for that reason we have to modify 2 default entries:

update-alternatives --config php
update-alternatives --config php-cgi

For both commands please change from default 7.2 to 7.0.
Then we can go to ISPConfig and add a new PHP Version, go to System and choose Additional PHP Version

in the first Register just give it a name, e.g. PHP 7.2.
The FastCGI Settings should be the following:

Path to the PHP FastCGI binary: /usr/bin/php-cgi7.2
Path to the php.ini directory: /etc/php/7.2/cgi/php.ini

The PHP-FPM Settings should be the following:

Path to the PHP-FPM init script: /usr/bin/php7.2
Path to the php.ini directory: /etc/php/7.2/fpm/php.ini
Path to the PHP-FPM pool directory: /etc/php/7.2/fpm/pool.d

Now all is set up and now you will be able to switch the PHP Version for customers and/or sites, however you want.

Hint: for my setup, it was needed to restart the selected PHP Version after changes take effect. So if you get a 503 Error please restart the selected PHP Version and all should be fine.


PHP-FPM Settings
FastCGI Settings

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.