Install/upgrade php switch between php versions
sudo a2dismod php8.0
systemctl restart apache2
sudo a2enmod php7.4
systemctl restart apache2
$ sudo update-alternatives --set php /usr/bin/php7.4
--------------------------
if a2dismod php8.2 throws error : php8.2 module cannot be found
run below command to install it
sudo apt-get install libapache2-mod-php8.2
Then a2dismod php8.2 will work
----------------------
References:
https://www.cloudbooklet.com/how-to-upgrade-php-version-to-php-8-0-on-ubuntu/