Page 1 of 3
[SOLVED]mysql_connect deprecated
Posted: Mon Sep 16, 2013 1:30 pm
by jillc
I'm just setting up my new pc - I downloaded the latest Xampp (1.8.3), downloaded the latest OC (1.5.6) and then set up a shop. However, I keep getting error messages: "Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in (...) \system\database\mysql.php on line 6"
Sometimes I get a popup window with a whole long list of variables which it is apparently having trouble with.
What can I do?
Re: mysql_connect deprecated
Posted: Mon Sep 16, 2013 2:15 pm
by rph
Download the mysqli database driver at:
https://raw.github.com/opencart/opencar ... mysqli.php
Upload it to your site then your config files to use mysqli.
Re: [SOLVED]mysql_connect deprecated
Posted: Mon Sep 16, 2013 6:03 pm
by jillc
Thanks rph. Your blood is worth bottling!
Re: [SOLVED]mysql_connect deprecated
Posted: Tue Sep 17, 2013 10:25 pm
by CZechBoY
put the
database driver there:
and edit
config.php (in root directory)
Re: [SOLVED]mysql_connect deprecated
Posted: Tue Sep 17, 2013 10:33 pm
by Buxworth
Many thanks
Buxworth
Re: [SOLVED]mysql_connect deprecated
Posted: Sat Oct 05, 2013 12:23 am
by vladmx
I followed CZechBoY instructions with file indicated by rph (the second one) and its working great. I also changed 'DB_DRIVER' line in config.php inside admin dir to eliminate the warnig message on the administrative pages.
However, with the mysqli driver I'm having problems with some characters displayed on the pages. I'm investigating how to fix it.
Re: [SOLVED]mysql_connect deprecated
Posted: Sat Oct 05, 2013 12:48 am
by vladmx
Adding the following line after $this->mysqli->set_charset('utf-8'); in mmysqli.php fixed my problem with foreign characters being displayed as question marks:
$this->mysqli->query("SET NAMES 'utf8'");
PHP manual (
http://php.net/manual/en/mysqli.set-charset.php) has the following note:
"This is the preferred way to change the charset. Using mysqli_query() to set it (such as SET NAMES utf8) is not recommended. See the MySQL character set concepts section for more information."
However, I couldn't find other way to make it work.
Re: [SOLVED]mysql_connect deprecated
Posted: Fri Dec 05, 2014 9:40 pm
by sugarskull
Can I reopen this?
I am having a very similar issue. The solution above worked to an extent but I am still seeing an error relating to the vqcache:
Fatal error: Class 'DBmysqliz' not found in /home/*/public_html/shop/vqmod/vqcache/vq2-system_library_db.php on line 13
or Fatal error: Class 'mmysqli' not found in /home/*/public_html/shop/vqmod/vqcache/vq2-system_library_db.php on line 13
I have tried deleting all from the cache, but no cigar!
Short of installing a fresh store, I am short of answers of what to do?
Can someone please help?
This problem is because I changed my host - of which have a more recent php 5.5 version.
Re: [SOLVED]mysql_connect deprecated
Posted: Wed Jan 07, 2015 4:08 am
by uhhmnet
@sugarskull
newer versions of OpenCart already contain the MySQLi driver.
simply edit config.php:
you should stop seeing errors.
cheers
-Lyle H.
Re: [SOLVED]mysql_connect deprecated
Posted: Thu Jul 16, 2015 11:32 pm
by 528491
uhhmnet wrote:@sugarskull
newer versions of OpenCart already contain the MySQLi driver.
simply edit config.php:
you should stop seeing errors.
cheers
-Lyle H.
Hello, sorry for bumping an old thread but I need to know couple of things regarding mysqli deprecation error, all on one place:
- Which version of Opencart was the first to support the mysqli driver? Is 1.5.5.1 supporting it correctly?
- If I use Opencart version that supports it, is the only step necessary to edit the config.php? No adding other lines of code mentioned in this thread?
- If I do a clean install of a newer Opencart version that supports the mysqli driver by default when clean installed, and then import a backup of my old 1.5.5.1 Opencart database that used the old mysql extension, will there be incompatibilities in database tables?
- What does actually enabling mysqli driver affect/alters in Opencart installation code? The Opencart code, the mysql database tables' code or both?
I will much appreciate the response, since searching the boards haven't helped me so far regarding these questions.
Re: [SOLVED]mysql_connect deprecated
Posted: Mon Aug 31, 2015 3:07 am
by faca5
Re: [SOLVED]mysql_connect deprecated
Posted: Sat Oct 10, 2015 8:28 am
by putinhk
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO
Anyone has more CLEARLY solutions?
i.e where to download/upgrade and config
Re: [SOLVED]mysql_connect deprecated
Posted: Tue Dec 01, 2015 1:34 am
by IP_CAM
putinhk wrote:Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDOAnyone has more CLEARLY solutions?
i.e where to download/upgrade and config
Just read here, that's all it takes!
http://forum.opencart.com/viewtopic.php ... 80#p572236
Ernie
Re: [SOLVED]mysql_connect deprecated
Posted: Wed Dec 02, 2015 10:08 pm
by TAC
I tried that but no luck

Re: [SOLVED]mysql_connect deprecated
Posted: Wed Dec 02, 2015 10:51 pm
by TAC
For anyone else following after me the issue in my case was that my PHP version had been upgraded and the old OC store couldn't work with it.
I set the PHP version to a previous one and the errors etc. disappeared

Re: [SOLVED]mysql_connect deprecated
Posted: Sat Dec 12, 2015 4:52 pm
by faca5
Hello.
Why use old PHP if you can use latest with all features?
You can solve your mysql_connect() problem with this extension:
http://www.opencart.com/index.php?route ... n_id=23099
Re: [SOLVED]mysql_connect deprecated
Posted: Sat Dec 12, 2015 11:32 pm
by IP_CAM
Re: [SOLVED]mysql_connect deprecated
Posted: Wed Jan 13, 2016 1:02 am
by DooooT
Download the file from the following link:
https://raw.githubusercontent.com/openc ... mysqli.php
Then UPLOAD the file into the following directory:
/public_html/system/database
Then MODIFY the config.php file at the following directory:
First directory: /public_html
Second directory: /public_html/admin
In both directories look for the following:
define('DB_DRIVER', '
mysqli');
Chang only the underline mysqli to become mmysqli
the final looks will be as following:
define('DB_DRIVER', 'mmysqli');
Save the changes in both directories.
That is it Engoy!!

Re: [SOLVED]mysql_connect deprecated
Posted: Fri Jan 15, 2016 2:51 pm
by Medina
solved my problem and help support very good, recommended, thank you very much.
Re: [SOLVED]mysql_connect deprecated
Posted: Tue Jan 26, 2016 10:32 pm
by thomash2
There is a lot of conflicting recommendations here.
http://forum.opencart.com/viewtopic.php?f=20&t=133437
http://forum.opencart.com/viewtopic.php ... 6&p=530799
http://forum.opencart.com/viewtopic.php?f=181&t=151859
Some of the hosting services are now phasing out php 5.4 and forcing upgrades to 5.5 and 5.6.
I'm running an older version pre 1.5.6 and I can't get it to work with either php 5.5 or 5.6.
I tried changing define('DB_DRIVER', 'mysql'); to mysqli but there is an error because there is an extra bracket in the code "}". I read that the mysqli.php is not functional in older versions of opencart.
The mysqli.php file is identical from 1.5.5.1 through 1.5.6.3, with the same extra bracket "}".
However it looks very different on 1.5.6.4.
I also checked the version on Github, but it also looks very different from the version in 1.5.6.4. But it appears to be for 2.x? Will it work with pre 1.5.6?
https://github.com/opencart/opencart/bl ... mysqli.php
I also looked at the mysqliz extension, which also looks very different from all the others. Is this safe to use?
http://www.opencart.com/index.php?route ... n_id=13041
Which of these 3 versions of mysqli.php is best to use for pre-1.5.6?
The version in 1.5.6.4
The version from Github
The version in the mysqliz extension
I also get an error in my older version of vqmod when I attempt to switch to php 5.5 or 5.6:
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in vqmod/vqmod.php ...
I read here to change the problematic line in the vqmod.php to:
$modFilePath = preg_replace_callback('/([^*]+)/', function ($m) { return preg_quote($m[1], "~"); }, $modFilePath);
http://forum.opencart.com/viewtopic.php?f=22&t=130679
If I decide to upgrade vqmod to the latest version using the "install" method, will I encounter additional problems, or is it safer to simply change this one line with the preg_replace_callback?