Switch to PHP 8.2
Run the following command to disable Apache module for other PHP versions
sudo a2dismod php*
Now, enable PHP 8.1 module in Apache server.
sudo a2enmod php8.2
sudo systemctl restart apache2
For Command Line Interface:
sudo update-alternatives --set php /usr/bin/php8.2
sudo update-alternatives --set phar /usr/bin/phar8.2
sudo update-alternatives --set phar.phar /usr/bin/phar.phar8.2
sudo update-alternatives --set phpize /usr/bin/phpize8.2
sudo update-alternatives --set php-config /usr/bin/php-config8.2
If you want a different version (eg: PHP 8.1 or PHP 8.0) to be configured as default, just replace 8.2 with the required version.

Leave a Reply