Multiple versions of PHP (Debian Stretch 9.x)

Multiple versions of PHP (Debian Stretch 9.x)

There are a few cases where you might want to keep your old version of PHP for compatibility, or preference, but also need a newer or cutting edge version for a particular app (eg. Nextcloud [howto/whyto post to follow]).
Fear not – this CAN be done. Here’s my marginally modified version of the post from here

check if your changes worked using something like this …

php -i | grep "opcache\|YOUR_MOD_NAME"

Once this is done and running, create a test VirtualHost …

This example is set up for PHP 5.6.
If you wanted to use 7.3, you would change this line in the config, and then restart apache2
SetHandler “proxy:unix:/var/run/php/php7.3-fpm.sock|fcgi://localhost/”

1 thought on “Multiple versions of PHP (Debian Stretch 9.x)

  1. Wow that was unusual. I just wrote an extremely long comment but after I clicked submit
    my comment didn’t appear. Grrrr… well I’m not writing all that over again. Anyway, just wanted to say wonderful blog!

Leave a Reply

Your email address will not be published.

2 × three =