If you are currently hosting your WordPress website or multiple WordPress websites at HostGator and you have encountered “your php installation appears to be missing the mysql extension which is required by wordpress”
We can help you resolve this issue quickly by following the steps in this article.
This is a very common issue on HostGator and Godaddy hosting platforms due to the way their server environment is configured. The good news is that the way to fix this problem only requires a few steps and is quite painless.
Why does your php installation appears to be missing the mysql extension which is required by wordpress error occurs?
The error message ” your php installation appears to be missing the mysql extension which is required by WordPress ” can appear when you are using a version of PHP that is incompatible with your script version (your WordPress installation is probably out of date).
Since the MySQL extension is deprecated (no longer supported) from PHP 7.0 and later, changing your version from PHP to 5.4 will fix the problem.
This can be done through the PHP Settings section of your website’s control panel.
How to fix the “Missing MySQL Extension” error
In the video below, we’ll walk you through identifying this error and then taking steps to resolve it. It is possible to have multiple .htaccess files that you may need to edit.
If you find that you are still getting this error after modifying the .htaccess file in the public_html folder, you will need to check your root directory.
Navigate to the root directory by clicking the top option in the left panel that begins with (/ home # / user), where the user is your cPanel username.
Scroll down in the right panel until you find another .htaccess file. Any .htaccess file that contains a string of numbers or additional characters in the name is disabled and can be ignored.
Follow the instructions below, starting with step 4.
Read: How to setup spf dkim and dmarc
Here are the steps outlined to solve “your php installation appears to be missing the mysql extension which is required by WordPress”
- Log in to cPanel.
- Find and select File Manager.
- Locate and open the public_html folder.
- Locate the .htaccess file, right-click on it, and select View.
To access the .htaccess file:
- Log in to your cPanel.
- In the Folders section, click the File manager to open.
- To view the .htaccess file, click Settings in the upper right corner.
- Make sure the Show hidden files (dotfiles) is checked.
- Click on Save. This will refresh the page and all files starting with a “. ”(Period) is displayed
In your .htaccess, you should see the PHP manager entries. Identify which needs file need editing.
The old PHP handler you want to remove will look like one of these:
# Use PHP73 as default
AddHandler application/x-httpd-php73 .php
<IfModule mod_suphp.c>
suPHP_ConfigPath /opt/php71/lib
</IfModule>
Or
#Use PHPedge as default
AddHandler application/x-httpd-php-edge .php
<IfModule mod_suphp.c>
suPHP_ConfigPath /opt/phpedge/lib
</IfModule>
Note: If you don’t see either of the two old PHP manager entries in your current .htaccess, try checking the .htaccess at a level above the root of your document. Click Raise one level on the top menu and find all .htaccess in the list of files.
The PHP handler you want to keep will look like the one below. You will notice that it says “handler generated by cPanel, do not edit” as previously created by MultiPHP handler.
# 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-php73 .php .php7 .phtml
</IfModule>
# php — END cPanel-generated handler, do not edit
These PHP handlers conflict with each other, which is why your site displays an error. You will need to remove the old PHP handler so that the .htaccess reads the code from the MultiPHP handler instead.
Once you have identified these PHP handlers, create a backup of your .htaccess file before making any changes.
In the pop-up window, it will provide the start of the path of the backup storage location. It will start with / public_html , and you’ll fill in the rest so that it reads /public_html/.htaccess, then click Copy File (s) .
You will now see the backup file in the main window named .htaccess.bak . You can still restore it by removing the .bear extension.
Right click on the .htaccess and click Edit .
To disable the PHP handler you don’t want, you can add a ” # ” at the start of each line,
like we did 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 on Save changes then Close to exit the editor.
If the above instructions don’t work and your site is still showing an error, we can do it for you with our general help desk.
Conclusion
The best solution would be to update your WordPress installation to be able to use php 7.3, PHP 7.3 offers several improvements over previous versions
If your WordPress site is running on PHP 5.4, it runs slower than it would in PHP 7.3 or 7.4.
If you haven’t been diligent about maintaining your WordPress software, plugins, and theme versions, and you haven’t made sure your developers support them well, you may have code that is incompatible with PHP 7.
Older versions of WordPress, as well as some themes/plugins, are not compatible with PHP 7.3 or higher.
Hope the information above has helped you resolve this “your php installation appears to be missing the mysql extension which is required by wordpress”