Back to Blog
Engineering22 October 20263 min read · 665 words

Your PHP Installation Appears to Be Missing the MySQL Extension

N7

No7 Engineering Team

Growth Architecture Unit

Engineering: Your PHP Installation Appears to Be Missing the MySQL Extension (illustration)

The "Your PHP installation appears to be missing the MySQL extension which is required by WordPress" error means PHP on your server cannot load mysqli, the extension WordPress uses to talk to its database. It usually appears right after a PHP version change, because the new PHP version was installed or selected without its MySQL extension. The fix is to install or enable mysqli for the PHP version the site now runs.

What triggers the missing MySQL extension error?

The wording mentions MySQL, but the check is for mysqli, the extension modern WordPress uses. The check lives in WordPress core's load.php. WordPress shows this message, under the title "Requirements Not Met", when the mysqli_connect function does not exist and there is no db.php database drop-in in wp-content. The full message continues: "Please check that the mysqli PHP extension is installed and enabled."

So the database itself is usually fine. PHP simply has no way to reach it. Typical causes:

  • A new PHP version without its extensions. On a server, each PHP version has its own extension packages. Installing PHP 8.3 does not bring over the MySQL extension you had for 8.1.
  • A hosting panel switch. Selecting a new PHP version in a control panel can load a different set of enabled extensions.
  • Different web and command-line PHP. The command line may have mysqli while the PHP-FPM pool that serves the website does not, or the reverse.
  • A Docker image rebuilt from a bare base. The official PHP images do not include mysqli until you install it in the Dockerfile.

How to fix the missing MySQL extension error

Pick the route that matches your hosting, then reload the site.

  1. On shared or managed hosting. If your control panel offers a PHP extensions selector, enable mysqli for the PHP version the site uses. Extension settings vary by host, so if you cannot find one, ask the host to enable mysqli for that PHP version.
  2. On Debian or Ubuntu. Install the MySQL package for the exact PHP version, for example php8.3-mysql for PHP 8.3, then restart PHP-FPM or the web server.
  3. On Red Hat, Alma, Rocky or Fedora. Install the php-mysqlnd package for the PHP stream you use, then restart PHP-FPM or the web server.
  4. In Docker. Add RUN docker-php-ext-install mysqli to the Dockerfile of an official PHP image, which ships that helper script, then rebuild and redeploy.
  5. Restart and verify. Run php -m and look for mysqli, then confirm the web side with a temporary phpinfo page and delete it afterwards. The web result is the one that matters for this error; check the command line too if you use WP-CLI or cron. Since PHP 8.2, mysqli is built on mysqlnd, as the mysqli installation page explains.

If the extension is installed but the error stays, the website is probably using a different PHP version or ini file than the one you changed. Check which PHP-FPM pool or PHP version the domain points at, rather than the server default.

If you roll back to an older PHP version, core can also stop with a message that the server runs a PHP version below what the WordPress release requires. On custom or very old PHP builds, it can report that a required extension such as json or hash is missing; both are built into PHP 8. For the full update process, including the backup and compatibility checks that prevent these errors, see how to update PHP in WordPress.

What to do next

Enable or install mysqli for the PHP version the site now runs, restart PHP, and check Site Health. Before the next PHP change, list the extensions the current version uses, so the new version gets the same set. If you are updating PHP because of the PHP2Shell vulnerabilities, keep going: the fixed PHP release still needs to be in place. Our WooCommerce development team can run the upgrade if you would rather not do it yourself.

Frequently Asked Questions

The questions buyers and engineers ask us most about this topic.

What does "Your PHP installation appears to be missing the MySQL extension" mean?

PHP on the server cannot load the mysqli extension, which WordPress needs to connect to its database. WordPress shows the message when the mysqli_connect function is missing and no db.php drop-in exists, usually right after a PHP version change.

How do I enable mysqli for WordPress?

On hosting with a control panel, enable mysqli in the PHP extension settings for the PHP version the site uses. On Debian or Ubuntu install php8.x-mysql for that version, on Red Hat systems php-mysqlnd, then restart PHP-FPM or the web server.

Why do I still see the error after installing mysqli?

The website is probably running a different PHP version or ini file than the one you changed. Check which PHP version or PHP-FPM pool the domain uses, and confirm mysqli appears in a phpinfo page served by the website.