WordPress says PHP is missing the MySQL extension
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.Short answer
WordPress lists mysqli among the PHP extensions it requires, because it uses it to talk to MySQL or MariaDB. The message means the PHP that serves the site has no mysqli loaded. Install your distribution's PHP MySQL package, or enable php_mysqli.dll in php.ini on Windows, then restart the web server or PHP-FPM.
Fix it fast
1Find out which cause you have
List the extensions of the PHP that serves the site, and look for mysqli. The command line can differ from the web PHP, so also check with a phpinfo page if the list looks right.
php -m | grep -i mysql2Match what you see, then jump to its fix
- 1
php -m prints no mysqli lineThe mysqli extension package is not installed (Linux)Fix - 2
Unable to load dynamic library php_mysqli.dll, or no mysqli in the module listThe extension is not enabled in php.ini (Windows)Fix - 3
Hosting panel shows mysqlnd enabled, WordPress still reports the errormysqlnd is present but mysqli is notFix
- 1
What does the error look like?
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
Cause 1 of 3
The mysqli extension package is not installed (Linux)
1Check
PHP packages from common distributions usually come without the database extension; it ships as a separate package. On Ubuntu the version-numbered name is php<version>-mysql, for example php8.3-mysql on 24.04.
dpkg -l | grep -i php | grep -i mysql2Fix
Install the package for your PHP version, then restart PHP-FPM or Apache.
sudo apt install php8.3-mysql
sudo systemctl restart php8.3-fpm3Verify
mysqli now shows up in the module list.
php -m | grep -i mysqliConfirmed by php.net
Cause 2 of 3
The extension is not enabled in php.ini (Windows)
1Check
On Windows the php_mysqli.dll file must be enabled in php.ini, and extension_dir must point at the folder that holds it.
php --ini2Fix
In the php.ini that command shows, set extension_dir to your PHP ext folder and enable mysqli, then restart the web server.
extension_dir = "c:\php\ext"
extension=mysqli3Verify
Open a new terminal and list the modules again.
php -mConfirmed by php.net
Cause 3 of 3
mysqlnd is present but mysqli is not
1Check
The WordPress hosting handbook says mysqlnd is the driver many PHP builds use underneath, but it is not a replacement for mysqli. The mysqli extension itself must be loaded.
php -m | grep -i -E "mysqli|mysqlnd"2Fix
Enable mysqli itself in the hosting panel's PHP extensions page, or install the package as in the first cause.
sudo apt install php8.3-mysql3Verify
Reload the site; the install page or login page replaces the error.
php -m | grep -i mysqliConfirmed by make.wordpress.org
How do I stop it coming back?
- After a PHP version upgrade, install the extensions again for the new version; packages are tied to one version.
- Keep a list of required extensions (mysqli among them) in your server setup notes.
- Compare the CLI and the web PHP with a phpinfo page after any change.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- ShopGoAn e-commerce aggregator with a Python scraping engine behind its catalog, past 10K Google Play downloads.
Related fixes
Back end
PDO::MYSQL_ATTR_INIT_COMMAND is an undefined class constant
Undefined constant PDO::MYSQL_ATTR_INIT_COMMAND
PDO only defines the MYSQL_ATTR_ constants when the pdo_mysql driver is loaded in the PHP process that runs your code.
3 causes, each with a fixBack end
Apache returns 503 or 504 because PHP-FPM did not answer in time
Error dispatching request
Apache sent the request to PHP-FPM and gave up waiting.
3 causes, each with a fixBack end
AWS SDK for PHP cannot get credentials from the instance profile metadata server
Error retrieving credentials from the instance profile metadata server.
The SDK tries the EC2 instance metadata service when it has no valid credentials from anywhere earlier in its chain.
4 causes, each with a fixBack end
AWS SDK for PHP rejects requests: the signature is from the future
Signature not yet current: {date} is still later than {date}
AWS compares the timestamp in your signed request with its own clock.
2 causes, each with a fixBack end
CodeIgniter 4 cannot write its cache files
CodeIgniter\Cache\Exceptions\CacheException: Cache unable to write to /var/www/app/writable/cache/
CodeIgniter 4's file cache needs a cache directory that the web server can really write to.
2 causes, each with a fixBack end
CodeIgniter 4: try/catch does not catch a failed insert in the model
DatabaseException
CodeIgniter throws a DatabaseException on a failed query only when DBDebug is true, and inside a transaction it does not throw unless you ask.
3 causes, each with a fix