How to get rid of the “Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future” message in OpenCart

How to get rid of the “Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future” message in OpenCart

Solution 1

  1. First, log into the cPanel dashboard.
  2. Locate and enter the File Manager.
  3. Once inside the File Manager, navigate to your store’s root folder. Most stores use the main domain, so the root folder will be public_html. If you are using a subfolder (e.g. example.com/shop), then you will look for public_html/shop.
  4. From here, click on the config.php and admin/config.php files, then open them for editing.
  5. Inside the editor, you will see the line of code that controls the mysql:
    define('DB_DRIVER', 'mysql');

    and replace it with:

    define('DB_DRIVER', 'mysqli');
  6. Save Changes. Refresh the website to see that message is gone.

Solution 2

Your server might require ‘mmysqli’ database driver to fix the issue.

  1. Download the file ‘mmysqli.php’ to your hard drive.
  2. Upload it to /system/database/ folder on your server.
  3. Open config.php and admin/config.php files on the server for editing.
  4. Locate the following line:
    define('DB_DRIVER', 'mysqli');
  5. Change it to:
    define('DB_DRIVER', 'mmysqli.php');
  6. Save Changes. Refresh the website to see that message is gone.

Was this article helpful?

Related Articles

Leave A Comment?