How to Downgrade PHP 7.1 to PHP 5.6 on Ubuntu 16.10, 16.04 and 14.04

Channel: Linux
Abstract: CLI$ sudo service apache2 restart

On your system, if you have installed both PHP 7.1 and PHP 5.6 version. PHP 7.1 is running as default PHP for Apache and CLI. For any requirement you need to use PHP 5.6. Then you don’t need to remove PHP 7.1. You can simply switch to PHP version 5.6 and set this as default for Apache and system command line.

Set PHP 5.6 as Default

Use the following set of commands to set PHP 5.6 as default version for Apache and command line.

Apache:-
$ sudo a2dismod php7.1
$ sudo a2enmod php5.6
$ sudo service apache2 restart
CLI:-
$ sudo update-alternatives --set php /usr/bin/php5.6

Ref From: tecadmin

Related articles