👋WE CAN FIX THIS NOW
If you are currently hosting your WordPress website or several WordPress websites at HostGator and you’ve come across “Your PHP installation appears to be missing the MySQL extension which is required by WordPress.” we can help you get this fixed quickly by following the steps in this post.
This is a very common issue in HostGator’s hosting platform because of the way their server environment is set up. The good news is the way to fix it is just a few steps and pretty painless.
How To Fix “Missing MySQL Extension” Error
In the video below, we will walk you through identifying this error and then the steps that will need to be taken to resolve it.
It is possible to have multiple .htaccess files that you may need to edit. If you find you are still getting this error after editing the .htaccess file in the public_html folder, you will need to check your root directory.
Navigate to the root directory by clicking on the top option in the left-hand panel that starts with (/home#/user), where user is your cPanel username.
Scroll down in the right-hand panel until you locate another .htaccess file. Any .htaccess file containing a string of numbers or additional characters in the name is disabled and can be disregarded.
Proceed with the instructions below, starting with Step 4.
Here are the steps outlined in the video above.
- Log in to cPanel.
- Locate and select File Manager.
- Locate and open the public_html folder.
- Locate the .htaccess file, right-click on it, and select View.
Here is a video guide to assist you in locating and editing your .htaccess file.
The steps in the video are outlined below.
To access the .htaccess file:
- Log into your cPanel.
- In the Files section, click on the File Manager to open.
- To display the .htaccess file, click Settings in the upper right-hand corner.
- Make sure the Show Hidden Files (dotfiles) is checked.
- Click Save. This will refresh the page, and all files starting with a “.” (dot) will be displayed.
In your .htaccess, you should see the PHP handlers entries. First, you’ll have to identify the one that needs to be removed.
The old PHP handler you’ll want to remove will look similar to one of these:
# Use PHP71 as default AddHandler application/x-httpd-php71 .php <IfModule mod_suphp.c> suPHP_ConfigPath /opt/php71/lib </IfModule>
#Use PHPedge as default AddHandler application/x-httpd-php-edge .php <IfModule mod_suphp.c> suPHP_ConfigPath /opt/phpedge/lib </IfModule>
Note: If you do not see any of the two old PHP handler entries in your current .htaccess, try checking the .htaccess from one level above your document root. Click Up One Level from the top menu and look for any .htaccess from the list of files.
The PHP handler you want to keep will look like the one below. You will notice that it says “cPanel-generated handler, do not edit” in it as previously created by the MultiPHP Manager.
# php -- BEGIN cPanel-generated handler, do not edit # Set the “ea-php73” package as the default “PHP” programming language. <IfModule mime_module> AddHandler application/x-httpd-ea-php73 .php .php7 .phtml </IfModule> # php -- END cPanel-generated handler, do not edit
These PHP handlers are conflicting with each other, which is why your site is showing an error. You will need to remove the old PHP handler so the .htaccess will read the MultiPHP handler code instead.
Once you’ve identified these PHP handlers, create a backup of your .htaccess file before making any changes.
In the pop-up, it will provide the beginning of the path of where to store the backup. It will begin with /public_html, and you’ll fill in the rest so that it reads /public_html/.htaccess.bak, then click Copy File(s).
Now you’ll see the backup file in the main window named .htaccess.bak. You can always restore this by removing the .bak extension.
Right-click on the .htaccess and click Edit.
To disable the PHP handler that you don’t want, you can add a “#” at the beginning of each line, as we’ve done in the example below.
#Use PHPedge as default #AddHandler application/x-httpd-php-edge .php #IfModule mod_suphp.c> # suPHP_ConfigPath /opt/phpedge/lib #/IfModule>
Click Save Changes and then Close to exit the editor.
Pull up your site to check if the error is already gone.
Hopefully the above information has helped you to resolve this very common error at HostGator of “Your PHP installation appears to be missing the MySQL extension which is required by WordPress.”
If the instructions above do not work and your site is still displaying an error, we can do this for you with our General Support service at https://www.wpfixit.com/wordpress-support-service/