HowTo: Ubuntu 16.04 serving not only php7 but 5.x versions too

1 post / 0 new
#1 Tue, 09/27/2016 - 02:51
just_me

HowTo: Ubuntu 16.04 serving not only php7 but 5.x versions too

Well,

came across this the other day and had some hrs. of googling and fumbling. Here is how to set it up, so you can use PHP 5.5, 5.6 and 7.0 parallel:

first add this to your /etc/apt/

deb http://ppa.launchpad.net/ondrej/php/ubuntu xenial main

Then import the correct public key:

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C

Now update your repository cache:

apt-get update

if it shows no errors, you can move forward. BTW for this you can ignore the error messages about the weak key for virtualmin repositories.

For PHP 5.5

apt-get install php5.5

For PHP 5.6

apt-get install php5.6

same goes for the php5 extensions.

apt-get install php5.6-curl

and the like. You can have PHP 5.5 AND PHP 5.6 AND PHP 7.0 running on the same machine and select under the according virtual server:

Server Configuration-> PHP Versions the PHP Version you want to use with that virtual server and Virtualmin does all the magic for you.

Best