Skip to content

Instantly share code, notes, and snippets.

@full-stack-king
Last active November 15, 2019 04:10
Show Gist options
  • Save full-stack-king/ea88aee90485260b6d7f182053a862f9 to your computer and use it in GitHub Desktop.
Save full-stack-king/ea88aee90485260b6d7f182053a862f9 to your computer and use it in GitHub Desktop.
How can I downgrade from PHP 7 to PHP 5.6 on Ubuntu 16.04? / How to change php version in Ubuntu Apache

Switch PHP version:

Note: change PHP version numbers to match your requirement. I have used 5.6 and 7.0

From php5.6 to php7.0 :

Apache:

Changing php version for Aapche server

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

CLI:

Changing php version for command line usage

sudo ln -sfn /usr/bin/php7.0 /etc/alternatives/php

Issue

if it is not working still, you may need to disable the proxy_fcgi apache module and give it a try again

sudo a2dismod proxy_fcgi proxy; sudo service apache2 restart

From php7.0 to php5.6:

Apache:

Changing php version for Aapche server

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

CLI:

Changing php version for command line usage

sudo ln -sfn /usr/bin/php5.6 /etc/alternatives/php

Issue

if it is not working still, you may need to disable the proxy_fcgi apache module and give it a try again

sudo a2dismod proxy_fcgi proxy; sudo service apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment