How can I delete a newer version of PHP while leaving the older ones?
Posted by chriscasemart@reddit | linuxadmin | View on Reddit | 3 comments
While upgrading a Ubuntu server from 18.04 to 20.04, I accidentally added PHP 8.1.
Some of the software I use requires PHP 7.4--which is also installed.
I believe I can remove PHP 8.1 with this command:
sudo apt remove --autoremove php8.1
But, will this remove other packages that PHP 7.4 still needs to run correctly?
If so, is there a different command I should run to remove PHP 8.1?
aenae@reddit
No need to remove it. I assume you're using Ondrej Sury's ppa to install php (as 8.1 isn't in 20.04 by default). This means the php versions are co-installable.
What you do is you use
sudo update-alternatives --config php
and chose the right version. And if you use apache you need to make sure the right php module is loaded: something likea2dismod php8.1 ; a2enmod php7.4
But a fair warning: php7.4 is EOL and security updates stop in a few months, try to see if you can either update the program or replace it with something more recent or fix the code yourself.
paijoh@reddit
This is the way if you use Ubuntu.
hotmaxblack@reddit
apt purge php8.1-cli