Loading...

Knowledge Base

How to Fix Error After MultiPHP Update

This article explains how to resolve a WordPress issue similar to the one shown below:

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"

This is followed by a file path in your cPanel directory and the following message:

"Your PHP installation appears to be missing the MySQL extension, which WordPress requires."

This fix requires you to access File Manager and modify website files.

In this article, we will cover the following topics:

How to Fix the "Missing MySQL Extension" Error

Use this workaround if you previously managed your site's PHP version with the PHP Selector and later changed it using cPanel's MultiPHP Manager.

Watch the video below to learn how to identify and fix the "Missing MySQL Extension" error.

 

  1. Log in to your Customer Portal.
  2. Go to Websites from the left navigation menu.
  3. Click Manage Site next to the website you want to manage.

    Edit Site button
     

  4. Navigate to the Files & Access tab.
  5. Find the File Manager, then click the Manage button.

    Customer Portal - File Manager  card
     

  1. Open your website's document root. For this example, we'll use the public_html folder.

    File Manager - public_html

  2. Locate the .htaccess file, right-click it, and select View.
  3. Identify the old PHP handler entries in the file. They will look similar to the examples shown below and should be removed.

    The old PHP handler you'll want to remove will look similar to one of these:

    # Use PHP81 as default AddHandler application/x-httpd-php81 .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>

    If you do not see either of these old PHP handler entries in your .htaccess file, try checking other .htaccess outside the public_html by clicking the Up One Level link in the top menu.

    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," created by the MultiPHP Manager.

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

    These PHP handlers conflicts with each other, which can cause your site to display this error. You will need to remove the old PHP handler so the MultiPHP handler code will take effect instead.

  4. Before making any changes, create a backup of the .htaccess file:
    1. Locate the .htaccess file.

      .htaccess file
       

    2. Right-click it and select Copy.
    3. The pop-up window will provide the beginning of where to store the backup. Enter the file name so that it reads /public_html/.htaccess.bak, then click Copy File(s).

      public_html.bak file
       

    4. You'll see the backup file, .htaccess.bak, in the public_html directory
  5. Right-click the .htaccess and select Edit.

    File Manager - .htaccess File - Edit
     

  6. When prompted, click Edit to open the editor.

    File Manager - .htaccess File - Edit Confirmation Prompt
     

  7. Do the necessary updates. To disable the PHP handler you don't want, add a "#" at the beginning of each line, as shown 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>

    There may be more than one old PHP handler entry in your .htaccess file. Continue adding "#" to 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
  8. Click Save Changes in the upper right-hand corner.

    File Manager - .htaccess File - Save Changes
     

  9. Click Close to exit the editor.
  10. Visit your website and verify that the error has been resolved.

Still Getting the "Missing MySQL Extension" Error?

It is possible to have multiple .htaccess files that you may need to edit. If the error persists after editing the .htaccess file in the public_html directory, check your root directory for additional .htaccess files.

  1. Navigate to the root directory by clicking on the top folder in the left-hand panel that starts with (/home#/user), where the user is your cPanel username.

    File Manager - Root Directory - .htaccess file
     

  2. Scroll down the right-hand panel until you locate another .htaccess file. Any .htaccess file with a string of numbers or characters is disabled and disregarded.
  3. Open the .htaccess file and check if there is an old PHP handler. Continue with the rest of the steps as discussed above.
  4. Once done, reload your website.

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.

MultiPHP Manager - Inherit

Frequently Asked Questions (FAQs)

What is the easiest way of viewing and updating the PHP version of my website?

cPanel includes MultiPHP Manager, which allows you to view and update your websites' PHP versions. For more information, refer to: What Version of PHP Are You Using? 

Where is my File Manager?

All website 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 files in the File Manager?

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

I completed the steps above, but my site now displays a different error (403, 404, or 500). How do I resolve it?

There are many reasons why your website may display an error page. Troubleshooting depends on the error page code (403, 404, 500, etc.) you are seeing. Please visit these helpful articles for more information on error page codes and how to resolve them.

How can we help you? Please contact us via phone or chat if you need assistance.

Loading...