1. Knowledge Base
  2. >
  3. Results
  4. >
  5. How to Fix Error After MultiPHP Update

How to Fix Error After MultiPHP Update

This article will discuss the workaround for your WordPress website if you encounter an issue similar to this one:

Missing MySQL Extension Error

The error will begin with:

"Warning: Use of undefined constant WP_CONTENT_DIR - assumed 'WP_CONTENT_DIR' (this will throw an Error in a future version of PHP) in"

Followed by a location in your cPanel directory and then
"Your PHP installation appears to be missing the MySQL extension, which is required by WordPress."

Note: This fix requires you to be comfortable navigating the File Manager and modifying files. If this is something you are not comfortable doing, our support team is here to assist you via phone or Live Chat 24/7/365.

You can click the links below to jump to a specific section of the detailed instructions below.

Note: This workaround will work if you previously used the PHP Selector to manage the PHP version for your site, then recently used the new MultiPHP Manager to update your PHP version.

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.
  1. 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.

    HostGator cPanel File Manager - Root Directory - .htaccess file

  2. 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.
  3. Proceed with the instructions below, starting with Step 4.

Here are the steps outlined in the video guide.

You may find some links below that will take you directly to your cPanel provided that the following conditions are met:
  • You are logged into your Customer Portal. You can also log in after clicking the link.
  • The hosting package you are attempting to access is either Shared or Cloud. The link will only work for the first type of this package listed in the billing account.
  1. Log in to cPanel.
  2. Locate and select File Manager.
  3. Locate and open the public_html folder.
    The public_html is the document root for your primary domain, which is why we're using it for this example. If you are doing this for a subdomain or an addon domain, you will want to go to that domain's document root instead.
  4. Locate the .htaccess file, right-click on it, and select View.

    Click to Know How to Locate your .htaccess File

    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:

    1. Log into cPanel.
    2. In the Files section, click on the File Manager to open. 

      HostGator cPanel - File Manager

    3. To display the .htaccess file, click Settings in the upper right-hand corner.
    4. Make sure the Show Hidden Files (dotfiles) is checked.
    5. Click Save. This will refresh the page, and all files starting with a "." (dot) will be displayed.

      HostGator - cPanel - File Manager - Show Hidden Files

    6. Click Save.
    7. You can now select your domain's document root. For this example, we will use the public_html folder.
    8. Inside your public_html, look for the .htaccess file. You may need to scroll your cursor a little bit to find it. 
  5. 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>
    	

    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 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.

    File Manager - Up One Level

    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.

  6. Once you've identified these PHP handlers, create a backup of your .htaccess file before making any changes.

    Click to Know How to Create a Backup of the .htaccess

    HostGator strongly recommends creating a backup of the .htaccess file before making any changes to it. Below are the steps on how to create a backup of your .htccess.

    1. In your directory, locate the .htaccess file.
    2. Right-click on it and select Copy.
    3. 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).
    4. Now you'll see the backup file in the main window named .htaccess.bak. You can always restore this by removing the .bak extension.
  7. Right-click on the .htaccess and click Edit.

    Click to Know How to Edit your .htaccess File

    To edit the .htaccess File:

    1. Right-click on the .htaccess file and click Edit from the menu. Alternatively, you can click on the .htaccess file and then click on the Edit icon at the top of the page.

      HostGator -  cPanel - File Manager - .htaccess File - Edit

    2. A dialogue box may appear asking you about encoding. Just click Edit to continue. The editor will open in a new window.

      HostGator - cPanel - File Manager - .htaccess File - Edit Confirmation Prompt

    3. Do the necessary edits. 

      HostGator - cPanel - File Manager - .htaccess File - Edit Code

    4. Click Save Changes in the upper right-hand corner when done.

      HostGator - cPanel - File Manager - .htaccess File - Save Changes

  8. 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>
    	
    Note: There may be more than one old PHP Handler entry in your .htaccess file. Repeat Step #8 for any additional entries. You should only have one entry that begins and ends with:
    # php -- BEGIN cPanel-generated handler, do not edit
    
    # php -- END cPanel-generated handler, do not edit
    
  9. Click Save Changes and then Close to exit the editor.
  10. Pull up your site to check if the error is already gone.
If the instructions above do not work and your site is still displaying an error, please try and continue with these steps.
  • Search for the .htaccess file outside your website's document root. This is the first .htaccess you saw when you opened the File Manager and before you clicked the public_html folder in Step 3 ⤴.
  • Check if there is an old PHP handler in the .htaccess one level up of your document root. If there is, disable it by adding a # as shown in Step #8 ⤴. Pull up your site again to check.
  • If the error is still there, go to your cPanel's MultiPHP Manager, and select your website name. Then, set your PHP version to inherit from the dropdown menu.

Related Topics

Is There a Way To View and Update PHP Versions Without Going Through the File Manager?

The cPanel has a MultiPHP Manager that allows you to view and update your websites’ PHP versions. Please refer to this article to know more about this feature: What Version of PHP Are You Using?

We have also created a video guide about the use of the MultiPHP Manager for you. Just click this link to go directly to your cPanel’s MultiPHP Manager.

Where is My File Manager?

All website contents or files are stored inside your File Manager. To learn how to access your File Manager, please visit this article: How to Navigate Through File Manager.

How Can I Edit My Files Inside the File Manager?

Your website files can be created, modified, or removed from your File Manager. Please visit the article, How to Create/Edit/Delete a File Using the File Manager, for detailed instructions on managing your website files inside the File Manager.


Additional References

Still having errors or need additional assistance? HostGator's support is here to help. Just reach out to us via phone or Live Chat!