How to downgrade PHP7 to PHP5.x ?

January 30, 2016 12.5k views
LAMP Stack PHP Apache Ubuntu

I upgrade my PHP in LAMP Ubuntu 14 server to PHP 7 following the tutorial -

However after testing the application for 2 days, I wanted to downgrade it back to the original php version because of many unexpected errors in composer packages.

Image :

Would be helpful if anyone can share the details.

1 Answer

This worked for me:

  • sudo apt-get remove -y --purge php7.0*
  • sudo add-apt-repository --remove ppa:ondrej/php
  • back php7 nginx conf
  • edit nginx conf to run php5:
    change: fastcgipass unix:/var/run/php/php7.0-fpm.sock
    to: fastcgi
    pass unix:/var/run/php5-fpm.sock;

  • sudo apt-get update

  • install php5:
    sudo apt-get install php5-fpm php5-mysql

Have another answer? Share your knowledge.