If you have ever tried to install or load WordPress and seen the error “Your PHP installation appears to be missing the MySQL extension which is required by WordPress,” you are not alone. This missing MySQL extension WordPress error stops your site cold and can feel overwhelming at first glance.
The good news is that it is almost always a PHP MySQL driver or server configuration issue. With the right steps, you can fix it without advanced technical knowledge.
TL;DR: Missing MySQL Extension: What You Need to Know
- PHP cannot find the database driver it needs to talk to MySQL, so WordPress fails to load. This is a PHP extension not loaded error at the server level.
- The error is usually triggered by a PHP upgrade, a server migration, or a misconfigured php.ini file, leaving the WordPress site unloading for all visitors.
- Enabling the MySQLi or PDO_MySQL extension in PHP resolves the issue in most cases.
- If server-level changes are outside your comfort zone, your hosting provider can apply the fix quickly.
Overview of the “Your PHP Installation Appears to Be Missing the MySQL Extension” Error in WordPress
This error occurs when WordPress cannot connect to the database because a required MySQL extension is missing or disabled in your PHP setup.

What Does the Error Message Mean in WordPress?
The full error message reads: “Your PHP installation appears to be missing the MySQL extension which is required by WordPress.”
In plain terms, PHP cannot locate the library it needs to communicate with your MySQL database. This missing PHP extension condition causes a WordPress database error before any content can render.
Without that connection, WordPress cannot load any content, settings, or parts of your site. The entire website becomes inaccessible.
This is not a WordPress bug. It is a server-level problem. WordPress simply detects the missing component and reports it.
Example of the Missing MySQL Extension Error Message
When this error occurs, you usually see one of the following on a blank white screen. This WordPress white screen often has no further explanation:
- “Your PHP installation appears to be missing the MySQL extension which is required by WordPress.”
- “We were unable to connect to MySQL.”
- “Can’t select database.”
These messages typically appear before the WordPress admin panel loads. You may also see this error during a fresh WordPress installation when the setup script cannot connect to the database.
Why This Error Breaks Your WordPress Website?
WordPress is entirely database-driven. Every page load triggers a PHP query to your MySQL database. A broken WordPress MySQL connection means WordPress cannot do any of the following:
- Retrieve posts, pages, categories, or comments.
- Load your active theme’s settings and widget configurations.
- Authenticate user logins.
- Execute any installed plugin’s functionality.
The result is a completely non-functional website. Visitors see an error screen rather than your content.
Relationship Between PHP, MySQL, and WordPress Database Connection
PHP is the scripting language that powers WordPress. MySQL is the relational database that stores all your site’s data, posts, users, settings, plugin data, and more.
These two systems communicate through a PHP extension that acts as a bridge. WordPress handles this internally through its database abstraction layer, the wpdb class.
Each time a visitor lands on your site, PHP sends queries to MySQL via the wpdb class, retrieves the relevant data, and returns the results as an HTML page. If the PHP extension required for this communication is missing or disabled, the entire process fails.
WordPress checks for this extension at startup. If it finds nothing, it throws a ‘missing MySQL extension’ error immediately.
MySQL vs MySQLi vs PDO MySQL Explained
Three PHP extensions can handle MySQL database connections:
- MySQL: The original PHP MySQL extension. It was deprecated in PHP 5.5 and permanently removed in PHP 7.0. WordPress dropped support for it at the same time. If your server runs PHP 7.0 or higher (which it should), this extension is simply unavailable. Using it was never a long-term option.
- MySQLi: The “improved” MySQL extension (the “i” stands for improved). You can enable MySQLi in PHP via php.ini or your hosting control panel. It supports both object-oriented and procedural programming styles. It also adds features like prepared statements and multiple statements. WordPress uses MySQLi by default when it is available.
- PDO_MySQL: PHP Data Objects, a more abstract database interface. It supports multiple database systems through a single, consistent API. WordPress can use PDO_MySQL as a fallback when MySQLi is unavailable.
Modern WordPress requires either MySQLi or PDO_MySQL to be installed and active. If neither is present, the missing MySQL extension error appears immediately.
Fix Errors Before They Break Your Site
Keep your WordPress site secure, updated, and error free with expert maintenance starting at just $49 per month.
What Causes the Missing MySQL Extension Error in WordPress?
Several distinct scenarios can trigger this error. Identifying the root cause is the first step toward the right fix.
- PHP Upgrade Without Extension Carry-Over When you upgrade PHP, say, from PHP 7.4 to PHP 8.1 or 8.2, the new PHP installation may not automatically include all previously active extensions. The php-mysqli package must often be reinstalled separately. The MySQLi extension can be left out of the new installation, even though it was active in the old one. This is one of the most common triggers for the error in production environments.
- Server Migration: Moving your WordPress site to a new server or switching hosting providers can result in a misconfigured PHP environment. Not all server stack configurations enable MySQLi by default. The new server may run PHP without it.
- Corrupted or Incomplete php.ini File The php.ini file controls every aspect of your PHP environment, including which extensions load and where PHP looks for them via the
extension_dirdirective. If this file is corrupted, incomplete, or missing the correct MySQLi extension line, PHP will throw a startup error, and WordPress will be unable to find the driver it needs.
- Multiple PHP Versions Running at Once. Some servers run multiple PHP versions side by side. If WordPress is pointing to the wrong PHP binary, one that lacks MySQLi, you will see this error even though other sites on the same server work fine. This PHP version conflict is easy to miss because the hosting control panel may show the correct version while the web server is using a different one.
- Fresh Installation on a Custom Server: New WordPress installations on custom-configured local servers such as XAMPP, MAMP, Laragon, or Docker containers often fail to enable MySQLi by default. Developers setting up local environments frequently encounter this because the php-mysqli extension must be enabled manually in most default XAMPP and MAMP setups.
- Hosting Provider Configuration Changes: Hosting providers occasionally adjust server configurations during maintenance windows or infrastructure upgrades. These changes can inadvertently disable previously active extensions.
Methods to Fix the Missing MySQL Extension Error in WordPress
You can resolve this issue by enabling the MySQL extension, updating PHP, or correcting configuration settings on your server.

Method 1: Install or Enable the MySQLi Extension in PHP
This is the most direct fix. On a Linux server, you can install the MySQLi extension using your package manager. The package is typically called php-mysqli on Debian-based systems.
For Ubuntu or Debian (install php-mysqli):
sudo apt install php-mysqli
sudo service apache2 restart
For CentOS or RHEL:
sudo yum install php-mysqli
sudo systemctl restart httpd
After installing, restart your web server. Then reload your WordPress site to check if the error clears.
If you are on shared hosting, look for a “PHP Extensions” or “Select PHP Extensions” section in your control panel (cPanel, Plesk, or similar). Locate mysqli in the list and enable it, then save. The change usually takes effect immediately.
Method 2: Check and Upgrade or Downgrade PHP Version
An incompatible PHP version is a frequent culprit. WordPress officially recommends PHP 8.1 or higher.
Running an unsupported version, especially one that is missing core extensions, causes this error. PHP 8.1 and PHP 8.2 both include MySQLi by default on properly configured servers.
To check and change your PHP version:
- Log in to your hosting control panel.
- Look for “PHP Version,” “MultiPHP Manager,” or a similar option (in cPanel, this is under “Software”).
- Switch to PHP 8.1 or 8.2, both of which include MySQLi by default.
If a recent upgrade broke your site, you can temporarily roll back to the previous version while you investigate. Some hosts allow per-domain selection of PHP versions.
Always test PHP version changes on a staging site before applying them to production. A version mismatch can break plugins and themes in addition to causing database errors.
Method 3: Update WordPress Core, Themes, and Plugins
Outdated core files, themes, or plugins sometimes trigger compatibility errors, including failures in the PHP database layer.
WordPress regularly updates its internal database abstraction class (wpdb) to support newer PHP versions and MySQL compatibility requirements.
To update WordPress:
- Navigate to Dashboard → Updates in your admin panel.
- Click Update Now for WordPress core.
- Then update all active plugins and themes.
If you cannot access the admin panel because the error is blocking it, update via FTP by uploading the latest WordPress files downloaded directly from WordPress.org. This is a safe way to refresh core files without touching your wp-content folder.
Always back up your full site and database before running any updates. This protects your data if something goes wrong during the process.
Method 4: Verify PHP Configuration Using phpinfo()
The phpinfo() function outputs a detailed report of your server’s PHP environment. Running a phpinfo() WordPress check is one of the fastest ways to confirm whether MySQLi or PDO_MYSQL is loaded.
- Create a new file named
info.phpin your WordPress root directory. - Add this single line:
<?php phpinfo(); ?> - Visit
yourdomain.com/info.phpin your browser. - Use CTRL+F to search for “mysqli” or “pdo_mysql” in the output.
If you see a section titled “mysqli” with enabled status, the extension is loaded. If it is absent, the extension is missing and needs to be added.
Security note: Delete the info.php file immediately after your check. Leaving it accessible exposes detailed server configuration data to anyone who visits the URL.
Method 5: Fix php.ini Configuration Issues
The php.ini file determines which PHP extensions load at startup. A comment character (semicolon) at the beginning of the extension line will prevent it from loading. The line you are looking for is extension=mysqli.
- Access your server via FTP or SSH.
- Locate your php.ini file. Common paths include
/etc/php/8.1/apache2/php.inior/etc/php.ini. - Search for the line:
;extension=mysqli - Remove the semicolon to uncomment it:
extension=mysqli - Save the file and restart your web server.
If your hosting provider restricts direct access to php.ini, create a custom .user.ini file in your WordPress root directory. Add extension=mysqli to it and save. PHP will pick up this .user.ini file automatically on most shared hosting platforms.
Method 6: Resolve Multiple PHP Version Conflicts
On servers running multiple PHP versions, WordPress may be assigned to the wrong one. If that version lacks MySQLi, the error appears.
To resolve this:
- Confirm which PHP version your site is using (via
phpinfo()as described in Method 4).
- In cPanel, open MultiPHP Manager and assign the correct PHP version to your domain.
- Open Select PHP Extensions and ensure
mysqliit is enabled for that specific version.
On a self-managed server, use php -v In the terminal, to confirm the active version and php -m | grep mysqli to confirm whether MySQLi is loaded for that binary. If php -m | grep mysqli, it returns nothing; the extension is missing for that version.
Method 7: Reinstall PHP and Required Extensions
If enabling MySQLi fails, the PHP installation itself may be corrupted. A clean reinstallation of PHP and the mysqli module resolves this.
On Ubuntu or Debian:
sudo apt purge php8.1 php8.1-mysql
sudo apt install php8.1 php8.1-mysqli
sudo service apache2 restart
On CentOS or RHEL:
sudo yum remove php php-mysql
sudo yum install php php-mysqli
sudo systemctl restart httpd
After reinstalling, run php -m | grep mysqli in your terminal to confirm the extension is now active. You should see “mysqli” in the output.
Method 8: Check Server Stack Configuration (Apache or Nginx and MySQL)
Your web server must correctly route PHP requests to the right PHP interpreter. Misconfiguration here can block extensions from loading even when they are installed.
- For Apache: Verify that
mod_phporphp-fpmis properly configured. Apachemod_phploads PHP as a module directly, while PHP-FPM runs as a separate process. Check your VirtualHost configuration to confirm the correct PHP handler is assigned.
- For Nginx: Nginx does not run PHP natively and always requires PHP-FPM. Confirm the
fastcgi_passdirective in your server block points to the correct PHP-FPM socket file. Ensure the PHP-FPM pool is running the version that supports MySQLi.
After any changes, restart both the web server and PHP-FPM:
sudo systemctl restart nginx
sudo systemctl restart php8.1-fpm
Read More: Apache vs Nginx: What’s Better for Hosting WordPress
Method 9: Contact Your Hosting Provider for Assistance
If any of the above methods feel too technical, your hosting provider is the fastest path to resolution. Most managed WordPress hosts handle PHP extension issues within minutes as part of their standard support.
When you contact support, include:
- The exact error message you are seeing.
- The PHP version your site currently uses (from phpinfo or cPanel).
- When the error first appeared, after an update, migration, or server maintenance.
Providers that offer managed WordPress hosting handle server-level PHP configurations, including PHP extension support, on your behalf.
On shared hosting, the support team can enable MySQLi from the server side without requiring any action from you.
Advanced Troubleshooting for Missing MySQL Extension Error in WordPress
If the standard methods above did not resolve the error, these advanced techniques can help pinpoint the problem.

Review Your wp-config.php File. Even with MySQLi installed, incorrect database credentials in your wp-config.php file will prevent a connection. Open wp-config.php and verify the following wp-config.php database settings:
define( 'DB_NAME', 'your_database_name' );
define( 'DB_USER', 'your_database_username' );
define( 'DB_PASSWORD', 'your_database_password' );
define( 'DB_HOST', 'localhost' );
A wrong value in any of these fields, especially DB_HOST. It can produce errors that appear to be missing-extension errors at first glance.
Some hosting providers use a specific hostname instead of localhost, and using the wrong value blocks the connection even when MySQLi is correctly installed.
Enable WordPress Debug Mode. Add these lines to your wp-config.php file to activate detailed error reporting. WP_DEBUG_LOG saves all errors to a file rather than displaying them publicly:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
The WP_DEBUG_LOG file is saved to wp-content/debug.log. Look for PHP extension-related messages or PHP startup errors in this file. Lines mentioning mysqli_connect, Call to undefined function, or missing module names point directly to the extension problem.
Review Server Error Logs. Apache stores error logs at /var/log/apache2/error.log. Nginx uses /var/log/nginx/error.log. These server error logs often capture the exact reason a PHP extension failed to load, such as a missing shared library, a wrong extension_dir path, or a file permission issue preventing the extension from being read.
Check for Conflicting Security Software. Web Application Firewalls (WAFs), server-level antivirus tools, and aggressive WordPress security plugins can occasionally interfere with PHP extension loading or block database handshake requests. Temporarily disable these and test again. If the error disappears, the security tool was the cause. Re-enable it and whitelist the database connection port (typically 3306) to restore protection without the conflict.
Test in a Staging Environment. Never test server-level changes directly on a live site. Use a staging environment to apply and verify fixes before pushing them to production. Most managed hosting providers include staging as part of their plans.
Best Practices to Prevent MySQL Extension Errors in WordPress
Prevention is always cheaper and less stressful than recovery. These practices reduce the likelihood of this error appearing on your WordPress site.
- Keep PHP Updated and Aligned With WordPress Requirements. Always run a PHP version that matches WordPress’s current recommendations (PHP 8.1 or higher as of 2024–2025). When upgrading PHP, verify that all required extensions, MySQLi, and PDO_MySQL are explicitly included in the new installation. Check the official WordPress PHP requirements page before every upgrade.
- Test PHP Upgrades on a Staging Site. Before updating PHP on your live site, run the new version on a staging environment. Conduct a WordPress PHP compatibility test using tools like the PHP Compatibility Checker plugin. Confirm that MySQLi loads correctly and that all plugins and themes remain compatible before pushing changes to production.
- Use Managed WordPress Hosting. Managed hosting providers handle server-level PHP configuration automatically. They keep PHP and its extensions up to date and correctly configured, greatly reducing your exposure to this type of error.
- Maintain Regular Site Backups. Always keep current backups of both your WordPress files and your database. If a server change causes this error, a backup lets you restore a working state while you fix the root cause.
- Monitor Your Site With Uptime Monitoring. Real-time WordPress uptime monitoring alerts you the moment your site goes offline. A downtime alert means you catch a MySQL extension error within minutes rather than hours. Minimizing downtime protects your visitors, search engine rankings, and revenue.
- Document Your Server Stack. If you self-manage your server, keep detailed records of all PHP extensions and configurations in use. This documentation makes it far easier to replicate the environment after migrations or major upgrades.
- Follow a Regular WordPress Maintenance Routine. A structured maintenance routine, including core, plugin, and theme updates, PHP version checks, and WordPress database optimization, prevents configuration drift and catches compatibility issues before they trigger live site errors. Schedule a monthly review of your PHP configuration alongside your usual maintenance tasks.
Final Thoughts
The “Your PHP installation appears to be missing the MySQL extension” error is disruptive but fixable. In most cases, the issue comes down to a disabled or missing MySQLi extension in your PHP configuration, a PHP database extension problem rather than a WordPress problem.
Start with the simplest path: check whether MySQLi is enabled in your hosting control panel and enable it if not. If that does not resolve the issue, work through the methods in order, reviewing your PHP version, editing php.ini with extension=mysqli, and reinstalling PHP if necessary.
When server-level changes are outside your expertise, your hosting provider can usually resolve them within minutes.
More importantly, set up the right conditions to prevent this error from recurring. Keep PHP up to date, use managed WordPress hosting, and commit to a regular maintenance routine. A well-maintained WordPress site avoids most of these errors before they reach your visitors, and recovers quickly when they do.
FAQs About Fixing “Your PHP Installation Appears to Be Missing the MySQL Extension” Error
What causes the missing MySQL extension error in WordPress?
This error appears when PHP cannot find or use the MySQL or MySQLi extension. It often happens after a PHP update or server misconfiguration.
How do I check if the MySQL extension is enabled?
You can create a phpinfo file or check your hosting dashboard. Look for MySQLi or PDO MySQL in the enabled extensions list.
Can updating PHP fix this error?
Yes. Updating to a supported PHP version can resolve compatibility issues and automatically enable required extensions.
Is this error related to my WordPress files?
Not directly. It is usually a server-level issue. However, outdated WordPress core files can sometimes trigger compatibility problems.
Should I contact my hosting provider to fix this?
Yes. If you cannot access server settings, your hosting provider can quickly enable the MySQL extension or adjust your PHP configuration.