If you are getting an error similar to Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future in some versions of Opencart, follow the steps below for a solution.
Example Errors:
Parse error: syntax error, unexpected ‘else’ (T_ELSE), expecting function (T_FUNCTION) in /home/SITENAME/public_html/SITENAME/system/database/mysqli.php on line 54
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/SITENAME/public_html/SITENAME/system/database/mysql.php on line 6
Opencart mysql_connect() Problem Solution
- Connect to your server via FTP.
- Open the config.php files in the main directory and the config.php files in the admin folder.
- Find the define(‘DB_DRIVER’, ‘mysql’); lines and replace them with the following.
- define(‘DB_DRIVER’, ‘mysqliz’);
- Download the system.zip file below and send it to your server.
- The problem will be fixed.