How to downgrade PHP7 to PHP5.x ?

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.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

From php5.6 to php7.0: Apache: sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart CLI: sudo update-alternatives --set php /usr/bin/php7.0 From php7.0 to php5.6: Apache: sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart CLI: sudo update-alternatives --set php /usr/bin/php5.6

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: fastcgi_pass 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

There’s any complication if i change the php version? my databases will remain?