Page 1 of 1

Upgrade to PHP 5 mysql extension is deprecated

Posted: Fri Sep 18, 2015 4:20 pm
by daggart
Hi

Opencart version:- 1.5.6

I'd appreciate some help please.
Yesterday both my website and admin showed an error message

'Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead.....'

I search the forum and found it it might be an upgrade to PHP 5 that caused it.

I've edited BOTH the config.php and the admin/config.php files and change the db driver FROM mysql to mysqli.

However now I have this error on website and admin page

Parse error: syntax error, unexpected 'else' (T_ELSE), expecting function (T_FUNCTION) in /home/dagg00/public_html/system/database/mysqli.php on line 54

Many Thanks,

Amanda

Re: Upgrade to PHP 5 mysql extension is deprecated

Posted: Fri Sep 18, 2015 9:27 pm
by OSWorX
The solution (and bug) is typically OpenCart: from his posting I assume that he is using 1.5.6 (0).
And with that version this file

Code: Select all

../system/database/mysqli.php
is simply shit because not ready to use!

@daggart: download a later published pversion, e.g. 1.5.6.1 or better and replace the old file with the new.

Re: Upgrade to PHP 5 mysql extension is deprecated

Posted: Fri Sep 18, 2015 11:04 pm
by daggart
Thank you.

Yes I've already changed the config files to reflect driver mysqli and I'm receiving the above error.

@OSWorX I've replaced the mysqli.php with a version from 1.5.6.4 but now I've got another error with my vqmod.


Warning: mysqli::mysqli(): (HY000/1045): Access denied for user '******'@'localhost' (using password: YES) in /home/dagg00/public_html/vqmod/vqcache/vq2-system_library_db.php on line 12

Fatal error: Call to undefined method mysqli::escape() in /home/dagg00/public_html/vqmod/vqcache/vq2-system_library_db.php on line 20

I've tried clearing cache, but still receiving this error.

Thanks,

Amanda

Re: Upgrade to PHP 5 mysql extension is deprecated

Posted: Fri Sep 18, 2015 11:21 pm
by OSWorX
Welcome in the world of OpenCart ..
The file db.php had also massive changes from version to version - maybe 1.5.6.4 was too high, 1.5.6.1 should be enough.
Unfortunetaly you have to try the files from different versions (but always both, the mysqli and the db) and see which one can then be used.

At the end it could be that you have to update the whole shop to a better version then 1.5.6.0 (1.5.6.5_rc should be sued then).

One word about your provider: if I would do such with my customers (updating important server components/software) I would have at the end of the week not one customer anymore!

Re: Upgrade to PHP 5 mysql extension is deprecated

Posted: Thu Jan 21, 2016 9:00 pm
by johnchene
I had the same problem.

Thank you so much, this saved me a lot of time and frustration.

JC

jpm

Re: Upgrade to PHP 5 mysql extension is deprecated

Posted: Fri Jan 29, 2016 1:18 pm
by ltoso
@johnchene
Hi,

i have 1.5.5.1 opencart and i am facing the same problem of getting deprcated error and simply changing

Code: Select all

define('DB_DRIVER', 'mysqli');
didn't work for me i also checked that there is a file lying that is mysqli.php and i also received the following error after changing the define parameter above

Parse error: syntax error, unexpected 'else' (T_ELSE), expecting function (T_FUNCTION) in /home/xxx/public_html/system/database/mysqli.php on line 54

Can you please tell me what fixed everything for you

Thanx

Re: Upgrade to PHP 5 mysql extension is deprecated

Posted: Tue Feb 23, 2016 7:55 am
by marciemarc
I had the exact same problem with 1.5.5.1 due to change of host PHP to 5.6 (mijndomein).
First I updated both config.php files from mysql to mysqli
After this I had the same error in line 54.

I downloaded 1.5.6.1, and I only uploaded these files:

system/database/mysqli.php
and
system/library/db.php

Don't forget to put the rights to 755 of these files.

And after this all my error messages were gone. Now I have to reinstall VqMod, this is a challenge again !

Greetz,
Marciemarc

Re: Upgrade to PHP 5 mysql extension is deprecated

Posted: Wed Jun 08, 2016 2:35 am
by werepair
This just fixed my error message using the 1.5.6 files as above