Upgrade to PHP 8.2 on DigitalOcean Droplet’s Ubuntu
Perform update and upgrade to the current Droplet.
List all the installed PHP version:
ls /etc/php/
The latest version should appear on the list.
7.4 8.0 8.1 8.2
If PHP 8.2 doesn’t exist, install it. If 8.2 exists, disable 8.0:
sudo a2dismod php8.0
If the error message (ERROR: Module php8.0 does not exist!) occurred, install:
sudo apt install libapache2-mod-php8.0
Enable version 8.2:
sudo a2enmod php8.2
If the error message (ERROR: Module php8.2 does not exist!) occurred, install:
sudo apt install libapache2-mod-php8.2
Restart Apache:
sudo service apache2 restart
If WordPress throws PHP MySQLi Extension error, install:
apt install php8.2-mysql
Restart Apache:
sudo service apache2 restart
Check WordPress’s Site Health. If the optional imagick module occurred, install:
sudo apt install php-imagick
Restart Apache:
sudo systemctl reload apache2