LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php5
apt-get dist-upgrade
This got PHP 7.0 on my system. To get PHP 5.6 I ran this:
apt-get install php5.6
I later found that I needed these extensions:
apt-get install php5.6-mysql
apt-get install php5.6-xml
apt-get install php5.6-gd
apt-get install php5.6-mbstring
apt-get install php5.6-mcrypt
apt-get install php5.6-zip
Apache was still running the old version, I disabled the php5 module, enabled php5.6 and restarted:
a2dismod php5
a2enmod php5.6
service apache2 restart
I had changed my PHP.INI file - which was in /etc/php5/apache2/php.ini
So I did similar changes in here /etc/php/5.6/apache2/php.ini
and restarted: service apache2 restart
The command line php was now running 7.0 so I changed it using this command:
update-alternatives --config php
Thanks to Ondřej Surý at https://launchpad.net/~ondrej/+archive/ubuntu/php