Fix “PHP installation appears to be missing the MySQL extension which is required by WordPress”

We recently saw this error on a newly migrated site, we were sure we had the mysql extension loaded correctly as a bunch of other wordpress sites were using the same PHP version without issue.

We started by downgrading the PHP version from 7.3 to something old we knew would work, PHP 5.6. We were right, the website started working. We checked the version of wordpress the site was running and it was version 3.4.1. We suspect this version of wordpress doesn’t support the newer MySQL PHP library.

This is what worked for us but might not work for you. In case it doesn’t, start by making sure you have the mysqlnd php library installed.

To install them try the following commands based on your OS and version of PHP:

yum install php-mysqlnd
yum install php74-php-mysqlnd
yum install php73-php-mysqlnd
yum install php72-php-mysqlnd
sudo apt-get install -y php-mysqlnd