Updating PHP in cPanel MultiPHP Manager, “Your PHP installation appears to be missing the MySQL extension”
As time goes on, upgrades become a necessity. Not only do they give access to new improvements, but they also help protect against known vulnerabilities.
I have upgraded PHP on a lot of Hostgator accounts this month as WordPress warns site administrators: “PHP Update Required WordPress has detected that your site is running an insecure version of PHP.”
Why is my PHP outdated?
Once upon a time, webhosts automatically updated PHP and MySQL on behalf of their customers. These upgrades were usually fine for up-to-date websites and those written with very simple code. But sometimes, these updates would break webpages or even worse, corrupt databases.
Now it is common to include tools so savvy customers can easily change PHP versions when they are ready. Unfortunately, this means many customers will suddenly find themselves several versions behind.
How do I upgrade PHP on Hostgator? (Fall 2020)
Reminder: Always make sure you have a fresh backup of your site before making major changes.
Log into cPanel and look under the Software section for “MultiPHP Manager”. This tool takes you to a page where you can select which domains and subdomains you want to control PHP for.
Choose the domains/subdomains you want to update, use the dropdown to select the correct PHP version, and click “Apply.”
Thoroughly check your website in case anything isn’t compatible with the new PHP version. If everything looks good but your site seems a little slow, try going up or down a PHP version.
MultiPHP Manager Broke My WordPress Site! What now?
Hostgator used to offer a cPanel tool called “PHP Selector” to change the PHP version in select folders. This tool added a few lines of code to the folder’s .htaccess file.
MultiPHP Manager controls PHP at a higher level. WordPress users switching from PHP Selector to MultiPHP Manger may notice error messages that include the line “Your PHP installation appears to be missing the MySQL extension which is required by WordPress.”
The fix is simple if you are comfortable editing .htaccess :
1. Open your favorite FTP program or cPanel’s file manager. Search for find the .htaccess .
You may have to adjust settings to show hidden files. cPanel’s File Manager has a settings button in the upper right hand corner.
Most sites have the affected .htaccess at either public_html or one level above. But I ran across two sites where the owners used PHP Selector on all of the sub-directories/folders.
2. Download or duplicate .htaccess and rename the copy with a timestamp in case it needs to be restored. (example: .htaccess_2020-08-28_14.50″)
3. Comment out the code that was added by PHP Selector
Sample Code Created by PHP Selector:
# Use PHP70 as default
AddHandler application/x-httpd-php70 .php
<IfModule mod_suphp.c>
suPHP_ConfigPath /opt/php70/lib
</IfModule>
Commented Out Version:
# Use PHP70 as default
#AddHandler application/x-httpd-php70 .php
#<IfModule mod_suphp.c>
# suPHP_ConfigPath /opt/php70/lib
#</IfModule>
4. Save changes and view your website to make sure everything is working. If not, un-comment or restore the .htaccess files and switch your PHP version back to what it was (or “default” if you don’t see your old version listed.) Contact your webhost or other trusted IT person for help.
5. (optional) Delete extra .htaccess files or code. I totally delete .htaccess files that only contain commented out code. (I used my favorite FTP program to compare the file sizes in bytes to make sure I didn’t overlook anything.) For other files, I only deleted the lines that contained the above commented out code.
Check your site again to make sure nothing is broken! Feel free to leave comments and additional tips below.
Hi, When I open my WordPress site hosted with HostGator., I’m greeted with this one liner:
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
The .htaccess in public_html reads:
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule . /index.php [L]
# END WordPress
# php — BEGIN cPanel-generated handler, do not edit
# Set the “ea-php73” package as the default “PHP” programming language.
AddHandler application/x-httpd-ea-php73 .php .php7 .phtml
# php — END cPanel-generated handler, do not edit
Which seems correct as far as I can see.
Any idea what I need to do to get my site up and running again?
Any help much appreciated.
Hello David. You need to comment out the “AddHandler” line too. If that does not work, you can check other folders for a .htaccess file that needs to be edited. (I found several of the same size and content that I was able to delete.)
If you still have problems after commenting out the AddHandler line and checking for extra .htaccess files, I would suggest contacting Hostgator support.
Hi, When I open my WordPress site hosted with HostGator., I’m greeted with this one liner:
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
The .htaccess in public_html reads:
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule . /index.php [L]
# END WordPress
# php — BEGIN cPanel-generated handler, do not edit
# Set the “ea-php73” package as the default “PHP” programming language.
AddHandler application/x-httpd-ea-php73 .php .php7 .phtml
# php — END cPanel-generated handler, do not edit
Which seems correct as far as I can see.
Any idea what I need to do to get my site up and running again?
Any help much appreciated.
Hello David. You need to comment out the “AddHandler” line too. If that does not work, you can check other folders for a .htaccess file that needs to be edited. (I found several of the same size and content that I was able to delete.)
If you still have problems after commenting out the AddHandler line and checking for extra .htaccess files, I would suggest contacting Hostgator support.