Use multiple version of PHP in ubuntu

apt-get update && apt-get upgrade

Step 2: Install PHP 5.6

Install the PHP5.6 repository with these two commands.

apt-get install -y software-properties-common

add-apt-repository ppa:ondrej/php

apt-get update

apt-get install -y php5.6

Step 3: Switch PHP 7.0 to PHP 5.6

Switch from PHP 7.0 to PHP 5.6 while restarting Apache to recognize the change:

a2dismod php7.0
a2enmod php5.6
service apache2 restart