Preguntas técnicas de características y respuestas a preguntas tipo qué es

Fix ‘PHP Missing MySQL Extension’ Error in WordPress 2026

You’re staring at a white screen, your WordPress site is down, and the message reads: «Your PHP installation appears to be missing the MySQL extension which is required by WordPress.» Annoying, right? This is one of those classic WordPress errors that hits when you least expect it: after a PHP update, a server migration, or a fresh install on a cheap host. And no, it’s not a WordPress bug. It’s your server.

The error «Your PHP installation appears to be missing the MySQL extension which is required by WordPress» means exactly what it says: PHP is running, but it can’t talk to MySQL because the connection driver (mysqli, or the older mysql) isn’t loaded. WordPress needs that bridge to read and write to your database. No bridge, no site.

Why this MySQL extension error shows up (and why it’s NOT WordPress’ fault)

WordPress core uses mysqli by default since PHP 5.5, and since PHP 7 the old mysql_* functions were removed entirely. So if your server is running PHP 8.x (and in 2026, most hosts push PHP 8.2 or 8.3 by default), the only valid extension is mysqli or pdo_mysql. If neither is enabled, the WordPress MySQL extension error is guaranteed.

Three real-world causes cover 95% of cases:

  • Your host disabled the extension. Shared hosts sometimes ship PHP without mysqli to save resources or because of a botched update. This is the most common reason.
  • php.ini has it commented out. A line like ;extension=mysqli with a semicolon at the start means PHP ignores it. Remove the semicolon and restart.
  • The extension simply isn’t installed. On VPS or dedicated servers where you compiled PHP yourself, you may have forgotten to include mysqli during compilation.

There’s a fourth scenario people miss: you switched PHP versions in cPanel or Plesk and the new version doesn’t have the module enabled. The fix is usually one click, but you have to know where to click.

How to confirm the MySQL extension is really missing

Before touching anything, verify. Create a file called info.php in your WordPress root with this single line:

<?php phpinfo(); ?>

Upload it, visit yourdomain.com/info.php, and search for «mysqli» (Ctrl+F). If you see a section called mysqli with support enabled, the extension IS loaded and your problem is elsewhere (usually a corrupted wp-config.php or a database host mismatch). If you don’t find it, confirmed: the PHP MySQL extension is missing.

Delete info.php immediately after checking. Leaving it public exposes your server config to anyone. Half the hacked sites I’ve seen started with a forgotten phpinfo file.

Fixing the WordPress MySQL extension error on shared hosting

If you’re on cPanel, log in and look for «Select PHP Version» or «MultiPHP Manager». Select your domain, pick the PHP version you’re using, and click the «Extensions» tab. Find mysqli, pdo_mysql, and mysqlnd, and tick the checkboxes. Save. Done.

On Plesk, go to PHP Settings inside your domain panel and enable mysqli under «PHP extensions». On DirectAdmin, it’s under PHP Settings → Extensions. If your host doesn’t offer any of these controls, open a support ticket and ask them directly: «Is the mysqli extension enabled for PHP 8.x on my account?» If they say no and won’t enable it, change hosts. Seriously. A host that refuses to enable mysqli is a host you don’t want.

Editing php.ini when you have root or VPS access

On a VPS or dedicated box, locate your php.ini. Common paths in 2026:

  • /etc/php/8.3/apache2/php.ini (Debian/Ubuntu with Apache)
  • /etc/php/8.3/fpm/php.ini (Debian/Ubuntu with PHP-FPM)
  • /etc/php.ini (CentOS, AlmaLinux, Rocky)

Open it with nano or vi, find the line ;extension=mysqli, remove the leading semicolon, and save. Then restart the PHP service:

sudo systemctl restart php8.3-fpm

Or for Apache: sudo systemctl restart apache2. Reload your WordPress site. If the WordPress MySQL extension error persists, check that extension_dir in php.ini points to the real folder where mysqli.so lives. A wrong path silently breaks everything.

Installing mysqli manually on Linux servers

If mysqli isn’t installed at all, install it via your package manager. On Debian/Ubuntu:

sudo apt install php8.3-mysql

On RHEL family:

sudo dnf install php-mysqlnd

The package php-mysql or php-mysqlnd is the one that ships mysqli and pdo_mysql together. Don’t install the ancient php-mysql package expecting the old driver — it’s gone in modern distros. After installing, restart PHP and reload your site.

When everything looks right but the error won’t go away

Sometimes the extension is enabled and the error still fires. Three culprits I’ve personally debugged:

  1. Multiple PHP versions running. Your CLI uses PHP 8.3 with mysqli, but Apache is serving PHP 7.4 without it. Check via phpinfo, not the terminal.
  2. OPcache serving stale code. Restart PHP-FPM or clear OPcache; a cached bootstrap can keep throwing the old error after the fix.
  3. Wrong wp-config.php DB_HOST. If you’re using «localhost» on a host that requires «127.0.0.1» or a socket path, WordPress can misreport the missing extension. Test with 127.0.0.1.

Also worth checking: if you migrated from another server and copied an old php.ini, it may reference extension paths that don’t exist on the new machine. Start fresh with the distro’s default php.ini instead of dragging old configs around.

The real takeaway: pick a host that doesn’t fight you

The WordPress MySQL extension error is a server-side config issue, not something you fix by reinstalling WordPress or editing theme files. If you’re on managed WordPress hosting like Kinsta, WP Engine, SiteGround, or Cloudways, mysqli is enabled by default and this error basically never appears. If you’re on a $1 shared host and they refuse to enable mysqli, that’s your signal to migrate.

My honest advice: before buying any hosting in 2026, ask support one question — «Is mysqli enabled on your PHP 8.3 stack?» If they hesitate, walk away. You’ll save yourself hours of debugging a problem that should never exist in the first place.