How to Downgrade PHP 7.1 to 5.6 on Ubuntu

Suppose your system is Ubuntu and PHP 7.1 install on your system. But your application is not supporting PHP 7.1. So you need to downgrade PHP 7.1 to 5.6 without removing the new version. You can simply switch your PHP version to default used for Apache and command line.

Downgrade PHP

We are assuming both PHP version is already installed on your system. So we are mentioning the steps to downgrade the PHP.

Downgrade PHP 7.1 to 5.6

In some situation we need to downgrade the PHP version without removing the new PHP. Follow below steps to downgrade the PHP.

Default PHP 7.1 is set on your system and you need to switch to PHP 5.6.


$ sudo a2dismod php7.1
$ sudo a2enmod php5.6
$ sudo service apache2 restart

Command Line:

$ sudo update-alternatives --set php /usr/bin/php5.6

Enjoy it!

No Responses

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.