Post by nuno » Wed Mar 23, 2016 6:16 pm

Hello, everyone,

I'm having a bit of an issue after upograding my PHP. After the build was done, I am getting the following message on OC 2.xx: Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/nuno/public_html/system/library/db/mysql.php on line 7

I have changed the BD files to mysqli but it still doesn't work.

Would any of you OC gurus happen to have a solution for this issue?

Thank you in advance!

Nuno
Last edited by nuno on Wed Mar 23, 2016 10:25 pm, edited 1 time in total.

Newbie

Posts

Joined
Mon Apr 07, 2014 5:15 am

Post by qahar » Wed Mar 23, 2016 6:27 pm

nuno wrote:I have changed the BD files to mysqli but it still doesn't work.
Do you change database driver in config.php and admin/config.php ?

User avatar
Expert Member

Posts

Joined
Tue Jun 29, 2010 10:24 pm
Location - Indonesia

Post by nuno » Wed Mar 23, 2016 6:35 pm

Hello, qahar, and thank you for your fast repli.

I went to home/nuno/public_html/system/library/db/mysql.php and replaced all mysql entries by mysqli. Is that what I was supposed to do? Where would I find the config.php file? I am terribly sorry, but I am new at this (as I am sure you can tell by now).

Thank you again!

Newbie

Posts

Joined
Mon Apr 07, 2014 5:15 am

Post by nuno » Wed Mar 23, 2016 6:37 pm

Sorry, found both files. I should simply replace the word mysql by mysqli?

Newbie

Posts

Joined
Mon Apr 07, 2014 5:15 am

Post by OSWorX » Wed Mar 23, 2016 6:38 pm

nuno wrote:Hello, qahar, and thank you for your fast repli.

I went to home/nuno/public_html/system/library/db/mysql.php and replaced all mysql entries by mysqli. Is that what I was supposed to do? Where would I find the config.php file? I am terribly sorry, but I am new at this (as I am sure you can tell by now).

Thank you again!
No, you have to change the driver inside the 2 config files only.

Custom Development | Individuelle Entwicklung | Support & Bugfixes

Image Image Image


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by nuno » Wed Mar 23, 2016 6:44 pm

Done, replaced mysql by mysqli in config.php and admin/config.php. Getting:

Fatal error: Class 'mysqli' not found in /home/nuno/public_html/system/library/db/mysqli.php on line 7

Newbie

Posts

Joined
Mon Apr 07, 2014 5:15 am

Post by nuno » Wed Mar 23, 2016 6:52 pm

Which is kind of odd, because the code seems correct:

<?php
namespace DB;
final class MySQLi {
private $link;

public function __construct($hostname, $username, $password, $database) {
$this->link = new \mysqli($hostname, $username, $password, $database);

My sqli does appear on line 7 (the last line of the code I pasted).

Newbie

Posts

Joined
Mon Apr 07, 2014 5:15 am

Post by OSWorX » Wed Mar 23, 2016 6:52 pm

Which shopversion are you using exactly??

Custom Development | Individuelle Entwicklung | Support & Bugfixes

Image Image Image


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by nuno » Wed Mar 23, 2016 7:00 pm

Thank you for your answer, OSWorX,

Can't login to the backoffice, but I believe it's 2.1.1

Newbie

Posts

Joined
Mon Apr 07, 2014 5:15 am

Post by OSWorX » Wed Mar 23, 2016 8:46 pm

nuno wrote:Thank you for your answer, OSWorX,

Can't login to the backoffice, but I believe it's 2.1.1
2.1.0.1 or 2.1.0.2 (no 2.1.1 version was ever published).

Nevertheless, it should work with both versions.
Did you revert your changes in the mysqli.php (if made)?
Maybe take the file of the original package and overwrite the already stored.

I hope for you that you are not playing around on a live shop??
If, change back to mysql driver and disable the output of error messages (see Settings).

Custom Development | Individuelle Entwicklung | Support & Bugfixes

Image Image Image


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by villagedefrance » Wed Mar 23, 2016 9:37 pm

Check that you have the Define for DB_PORT in your config.php files:

Code: Select all

define('DB_PORT', '3306');

OpenCart custom solutions @ https://villagedefrance.net


User avatar
Active Member

Posts

Joined
Wed Oct 13, 2010 10:35 pm
Location - UK

Post by OSWorX » Wed Mar 23, 2016 9:58 pm

Sorry, forgot that value completely, introduced with the 2.1.x. series ..

But basically if a 'customer' can edit code, he could also check by himself for such ..
On the other side, if the OC documention (and complete changelog) would be exist, such stupid posts would be not required.

Custom Development | Individuelle Entwicklung | Support & Bugfixes

Image Image Image


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by nuno » Wed Mar 23, 2016 10:25 pm

Thank you all for your answers. The error was due to the install of an OC extension. I have quite a few and this one was in conflict with another one. The dev tols me I needed to install mysqli in order for the extension to work, which I did, that caused all the errors I posted (and with wich you were so kindly helping me with). So I asked the company that makes the extension to either help ou a bit more or simply remove it (because I couldn't log into the backoffice).

They removed it and everything works fine thanks to you guys.

Thank you all again!

Newbie

Posts

Joined
Mon Apr 07, 2014 5:15 am
Who is online

Users browsing this forum: Baidu [Spider] and 4 guests