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?