Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

WordPress says PHP is missing the MySQL extension

ErrorYour 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.

  • Applies to WordPress 6.8, PHP 8.3, Ubuntu 24.04, Windows PHP 8.3
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 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 mysql
  2. 2Match what you see, then jump to its fix

    1. 1php -m prints no mysqli lineThe mysqli extension package is not installed (Linux)Fix
    2. 2Unable to load dynamic library php_mysqli.dll, or no mysqli in the module listThe extension is not enabled in php.ini (Windows)Fix
    3. 3Hosting panel shows mysqlnd enabled, WordPress still reports the errormysqlnd is present but mysqli is notFix

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 mysql

2Fix

Install the package for your PHP version, then restart PHP-FPM or Apache.

sudo apt install php8.3-mysql
sudo systemctl restart php8.3-fpm

3Verify

mysqli now shows up in the module list.

php -m | grep -i mysqli

Confirmed by php.net

Did this fix it?

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 --ini

2Fix

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=mysqli

3Verify

Open a new terminal and list the modules again.

php -m

Confirmed by php.net

Did this fix it?

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-mysql

3Verify

Reload the site; the install page or login page replaces the error.

php -m | grep -i mysqli

Confirmed by make.wordpress.org

Did this fix it?

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:

Related fixes

Back 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 fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.