Fix the missing WordPress MySQL extension error with Hostgator

PHP is the programming language we use to build and maintain WordPress. Newer versions of PHP are both faster and more secure. If WordPress detected that your site is running on an insecure version, you will be prompted to update. In an previous guide, we showed how to update PHP version for WordPress sites with Hostgator web hosting. Hostgator offers either PHP Selector or MultiPHP Manager plugin depending on your server to manage the PHP version for your site.

If you previously used the PHP Selector to upgrade the PHP version to a newer version, and then recently used the new MultiPHP Manager plugin to update PHP, you may have this error on your site.

Warning: Use of undefined constant WP_CONTENT_DIR – assumed ‘WP_CONTENT_DIR’ (this will throw an Error in a future version of PHP) in /home1/xxxx/public_html/wp-includes/load.php on line 115

Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

This error is caused by the duplicate handler in the .htaccess file and can be easily fixed by following the steps below.

Back up the .htaccess file

Log into the cPanel with Hostgator. Go to Websites > Files > File Manager. Locate the document root for your domain or website. If you host only one website in the hosting account, its default root is usually the public_html folder. If you are doing this for a subdomain or an addon domain, find the document root for that domain instead. The .htaccess file can be found at the site root director. Create a new folder in the root. Then right click on the .htaccess file, select Copy from the context menu, then enter the file path, type in the new folder name to copy this configuration file to. You can also download a copy of this file from your server to your local computer as a backup.

Edit .htaccess file

In the File Manager, right-click on .htaccess, select Edit from the context menu, and then click Edit again from the pop-up window. In your .htaccess file, click the Search button, type in ‘addhandler’, you should find two entries for PHP handlers.

Fix the missing WordPress required MySQL extension error with Hostgator

The old one you’ll need to remove will look like one of these:

# Use PHP71 as default
AddHandler application/x-httpd-php71 .php
<IfModule mod_suphp.c>
    suPHP_ConfigPath /opt/php71/lib


#Use PHPedge as default
AddHandler application/x-httpd-php-edge .php
<IfModule mod_suphp.c>
    suPHP_ConfigPath /opt/phpedge/lib

The new one you want to keep will look like the one below.

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php74” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
# php -- END cPanel-generated handler, do not edit

Click Save Changes and then Close to close the editor. Try to reload your website from browser see if the error is gone.

Bonus tips

  1. If your .htaccess file has more then one old PHP Handler entry, you should disable all those outdated PHP handlers and have only one entry.
  2. If your site is still displaying the missing WordPress required MySQL extension error, search for another .htaccess file above your website’s document root. Open that .htaccess and check if there is a PHP handler in there and disable it. Again, you may duplicate or backup the .htaccess file before you editing it.


  1. I use HostGator for hosting my WordPress site and after update the new PHP version with the MultiPHP Manager plugin Yesterday, from that time It’s showing MySQL extension error. I have been searching a lot for the solution but didn’t get the proper solution. After getting your post I have tried your shown way and at last abled to solve this problem. Thanks a lot for sharing.

  2. Thank you for this. I am so new to doing anything like this and it is severely nerve wracking changing anything, when you are not 100% confident in what you might be doing! This was the perfect fix and got my site back up and running!

Leave a Reply