How to downgrade PHP 7.2 to PHP 7 in ubuntu – digitalocean LAMP droplet

You can switch from PHP 7.2 to PHP 7.0 by taking the following steps on your LAMP droplet:

1. Add the following PPA and update your package list:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

2. Install PHP 7.0 and related packages from the repository:
sudo apt-get install php7.0 php7.0-cli php7.0-common php7.0-json php7.0-opcache php7.0-mysql php7.0-mbstring php7.0-mcrypt php7.0-zip php7.0-fpm

2. Disable PHP 7.2 and enable PHP 7.0:
sudo a2dismod php7.2
sudo a2enmod php7.0

3. Restart Apache:
sudo service apache2 restart

Apache should now be using PHP 7.0 instead of 7.2! 🙂