Install 2 version of PHP

Today I got again problem with PHP 7 and PHP 5 for mysql_connect which is deprecated in PHP 7.

So, this is the way to install both version , and use it when require .
Apache:

sudo a2dismod [php old] ;
sudo a2enmod [php new] ;
sudo service apache2 restart

to update the php cli to use the specific version
CLI:
sudo update-alternatives –set php /usr/bin/[php new]

Advertisements