More fixes

"Your PHP installation appears to be missing the MySQL extension which is required by WordPress"

Every page of the site, the admin included, shows one plain line: "Your PHP installation appears to be missing the MySQL extension which is required by WordPress. Please check that the mysqli PHP extension is installed and enabled." Nothing is lost: the database and the files are fine. PHP simply cannot talk to the database, and that almost always started with a PHP version change.

What the owner sees

lakesideflorist.example

What the checks found


  

Find out which case it is (five minutes)

  1. Ask what changed. A PHP version switch in the host panel, a host's own upgrade e-mail ("PHP 7.4 is end of life, your sites move to 8.x"), a server move or a new VPS is the cause nine times out of ten.
  2. Open the host panel's PHP settings ("Select PHP Version", "PHP Selector", "MultiPHP Manager" or similar) and note the version the site runs now, and whether mysqli (or nd_mysqli) is ticked in the extensions list for that version.
  3. Check how old WordPress is. Open wp-includes/version.php in the file manager and read $wp_version. Very old versions (before 3.9) only knew PHP's old mysql extension, which PHP 7 removed, so they show this message on any modern PHP even with mysqli switched on.
  4. On your own server or VPS, check the PHP that serves the site, not the command line: they can be different versions. php -m answers for the command line only; a phpinfo() page (delete it straight after) answers for the web server.

The fixes, by case

  1. Quickest way back up: switch the PHP version back to the one the site ran yesterday. The site returns at once, and you can then do the real fix without the shop being down.
  2. mysqli is off for the new version (shared hosting). In the PHP extensions list, tick mysqli, or nd_mysqli on CloudLinux-style selectors (one of the two, not both), save, and reload the site. Each PHP version has its own list, so a switch can quietly reset it.
  3. The extension is not installed (your own server). Install the MySQL package for the exact PHP version that runs the site, for example php8.2-mysql on Debian or Ubuntu, then restart PHP-FPM for that version (or the web server). Check again with a phpinfo() page and remove it.
  4. WordPress itself is very old. Put the old PHP version back, take a full backup, update WordPress, the theme and the plugins step by step on the old PHP, and only then move to the new PHP. Expect some old plugins to need replacing; the outdated PHP guide covers the order.
  5. Test: open the home page, log in, and add something to a cart or send the contact form. Then check the error log stays quiet for a day.

What you see, what it means, what it needs

What you seeWhat it meansUsual fix
Started right after a PHP version changeThe new version has mysqli switched offTick mysqli for that version, or switch back first
Started after a server move or a new VPSThe MySQL extension was never installed thereInstall the php-mysql package for that PHP version, restart PHP
mysqli is on and the message staysWordPress older than 3.9, or the web server runs a different PHP than you checkedCheck $wp_version and a phpinfo page
"Error establishing a database connection" insteadPHP can reach MySQL code but not the databaseSee the database connection guide
"There has been a critical error" after the PHP changeA plugin or theme breaks on the new PHPSee the critical error guide

What not to do

Most of these are one tick box in the host panel and are fixed in minutes. If the site is very old, or it runs on its own server and nobody knows how it was set up, that is what the box below is for. Related: outdated PHP, database connection error and "There has been a critical error".