Fixing the Missing MySQL Extension Error
WordPress needs the mysqli extension and the PHP that is serving the site does not have it loaded. The database is fine. The extension is one checkbox in a hosting panel, one package on a server, or one line in a Docker image, and the error appears right after a PHP version change.
WordPress checked for the mysqli extension before touching the database, and the PHP serving the site does not have it. "Your PHP installation appears to be missing the MySQL extension which is required by WordPress." has nothing to do with the database server, the credentials in wp-config.php, or the tables. It is PHP's build or configuration, and it almost always follows a change of PHP version.
Confirm which PHP is missing it
The PHP that serves web requests and the PHP on the command line are often different installs with different extension sets, so test the web one. The simplest check is a one-line file in the site root:
<?php
echo extension_loaded( 'mysqli' ) ? 'mysqli loaded' : 'mysqli missing', ' — PHP ', PHP_VERSION;
Load it in a browser, note the result, delete the file. If the command line is the one you can reach, php -m | grep mysqli and php -v tell you about that PHP, which may not be the one the site uses. A phpinfo() page lists both the loaded extensions and the php.ini path in use, which is the next thing needed.
Panel hosting
Control panels keep a per-version list of extensions. After switching from one PHP version to another, open the PHP settings or "Select PHP Version" screen, choose the version the site runs, and enable mysqli — and mysqlnd, which mysqli depends on in most builds. Some panels offer nd_mysqli as an alternative that uses the native driver; enable one or the other, not both. Save, then reload the site; no restart is needed on those setups.
If the extension shows as enabled and the error persists, the site may be on a different PHP version than the one you edited: a per-directory handler in .htaccess, or a domain-level setting, can pin a folder to another version. The panel's "PHP version" for the domain and the version reported by the test file above must match.
Your own server
Install the extension for the PHP version in use and restart the PHP process:
# Debian / Ubuntu (8.3 needs Ubuntu 24.04 or a third-party PHP repository on Debian 12)
apt install php8.3-mysql
systemctl restart php8.3-fpm
# RHEL / Rocky / Alma
dnf install php-mysqlnd
systemctl restart php-fpm
Match the package to the version actually serving the site, which depends on how the server stack is put together — php8.3-mysql for 8.3, and so on. On Debian-family systems the package is -mysql even though it provides mysqli. Apache with mod_php needs an Apache restart instead of FPM. The same version-mismatch issue arises here: upgrading PHP with the package manager installs a new version alongside the old and does not carry extensions across, which is the mechanism behind many cases of a site breaking after a PHP update.
Docker
The official PHP images ship without mysqli. A Dockerfile needs:
FROM php:8.3-fpm
RUN docker-php-ext-install mysqli
The WordPress images include it already. If a custom image was built from the plain PHP base and then updated to a new tag, the extension line may have been lost in the rebuild. Rebuild and restart the container; the error disappears on the next request.
The error on a site that was working
The usual sequences:
- A host upgraded PHP for everyone, and the new version's defaults omit the extension. Enable it for that version.
- Someone switched PHP in the panel to fix something else. Enable it there, or switch back.
- A server package upgrade installed a new PHP without extensions. Install them for the new version.
- A
php.inior aconf.dsnippet was replaced, and theextension=mysqliline was dropped — on Debian-family packages it lives inconf.d/20-mysqli.ini, not inphp.ini. Restore it, restart PHP.
None of these touch the database, which is why connecting with another tool works fine while WordPress refuses. If after enabling the extension the site shows a different error about the database, that one is about connecting and has its own checks in error establishing a database connection.
Verify
Reload the test file: it should print mysqli loaded with the version the site runs. Then load the site; it should render. Finally, open Tools › Site Health › Info: the Server section shows the PHP version, and the Database section's Extension row should read mysqli. If the panel shows the extension enabled but the test file says missing, the site is being served by a different PHP than the one you configured, and the handler or domain setting is where to look.
Frequently asked
- The host changed the PHP version, or an automatic update did, and the new version's extension set does not include mysqli. Hosting panels keep extensions per PHP version, so switching versions silently drops any extension not enabled for the new one.
- No. The error is about PHP's ability to talk to a database at all, not about whether a database is reachable. WordPress checks for the mysqli function before trying to connect, unless a wp-content/db.php drop-in replaces the database layer.
- Not on any supported PHP. The mysql extension was removed in PHP 7.0. Current WordPress requires mysqli, and the message names MySQL generically because the check predates the removal.