Ubuntu 16.04 Php5 Apache2

As per http://askubuntu.com/questions/756879/cant-install-php5-on-ubuntu-16-04

Add Ordnj's repository

Also check his website^ more more up to date information.

sudo add-apt-repository ppa:ondrej/php

sudo apt-get update

Install php5 alongside php7

sudo apt-get install php7.0 php5.6 php5.6-mysql php-gettext php5.6-mbstring php-xdebug libapache2-mod-php5.6 libapache2-mod-php7.0

Enable the desired php version

Switch from php5.6 to php7.0

sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart

Switch from php7.0 to php5.6

sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart

Checkout oerdnj's github guide.