Downgrade PHP Version

I am running PHP 8 in Linux Mint 19.1. Now I need to run PHP 7. How can I do that ?

enter image description here


Since Mint is a Debian/Ubuntu derivative, the following should work:

sudo update-alternatives --config php

Your system should then display a list of the PHP versions that are installed on your system and you can manually choose one to become the default, like this:

There are 5 choices for the alternative php (providing /usr/bin/php).

  Selection    Path             Priority   Status
------------------------------------------------------------
* 0            /usr/bin/php8.0   80        auto mode
  1            /usr/bin/php7.0   70        manual mode
  2            /usr/bin/php7.2   72        manual mode
  3            /usr/bin/php7.3   73        manual mode
  4            /usr/bin/php7.4   74        manual mode
Press <enter> to keep the current choice[*], or type selection number:

If you need Apache to run with an alternative PHP version as well, you can do this with the following commands (to switch from PHP 8.0 to PHP 7.4 for example):

sudo a2dismod php80
sudo a2enmod php74
sudo systemctl restart apache2

As I see from your question that your PHP 7.4 installation was not complete because of a dependency issue, the above procedure will only work when this issue is resolved and all required PHP 7.4 packages have been installed.