This tutorial will show you how to get rid of the ‘Deprecated mysql_connect() The mysql extension is deprecated and will be removed in the future’ message in OpenCart 2.x.:
First, log into the cPanel dashboard.
Locate and enter the File Manager.
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.
From here, click on the config.php and admin/config.php files, then open them for editing.
Inside the editor, you will see the line of code that controls the mysql:
and replace it with:
Save Changes. Refresh the website to see that message is gone.
Your server might require ‘mmysqli’ database driver to fix the issue.
Download the file ‘mmysqli.php’ to your hard drive.
Upload it to /system/database/ folder on your server.
Open config.php and admin/config.php files on the server for editing.
Locate the following line:
Change it to:
Save Changes. Refresh the website to see that message is gone:
Feel free to check the detailed video tutorial below: