Post by Weiqunw » Fri Oct 09, 2015 9:27 pm

Hi!

We got a new php 5.6 server running next to our php 5.3 server. We got a OC 1.5.6.4 webshop and on php 5.3 it is working perfect. I just uploaded the webshop to the php 5.6 server, cleaned the cache etc. But i'm getting the following error:

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/puchshop/public_html/test2/vqmod/vqcache/vq2-system_startup.php on line 117

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/puchshop/public_html/test2/vqmod/vqcache/vq2-system_startup.php:117) in /home/puchshop/public_html/test2/vqmod/vqcache/vq2-system_startup.php on line 135

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/puchshop/public_html/test2/vqmod/vqcache/vq2-system_startup.php:117) in /home/puchshop/public_html/test2/vqmod/vqcache/vq2-system_startup.php on line 135

The DB_driver in the config.php and admin/config.php files are already on mysqli, this was also on the php 5.3 server so it has to work but it doesn't work.

I searched on google and here on the forums, but didn't got a solution to get this work.

Can anybody help us?

I also tried this mod but didn't work: http://www.opencart.com/index.php?route ... n_id=23099

Kind regards,
Weiqunw

Active Member

Posts

Joined
Wed Jul 10, 2013 3:29 pm
Location - Arnhem, the Netherlands

Post by IP_CAM » Sat Oct 10, 2015 12:12 am

Just GOOGLE FOR THIS, and set the value to DURING THE PAST MONTH:

Code: Select all

Deprecated: mysql_connect(): The mysql extension is deprecated opencart
and you will find out easy, many already answerred Postings already exist on this!
Ernie

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by victorj » Sat Oct 10, 2015 5:14 am

Just adjust both config files in root and admin
find

Code: Select all

define('DB_DRIVER', 'mysql');
change to

Code: Select all

define('DB_DRIVER', 'mysqli');
that should solve your problem

Koeltechnische deurrubbers eenvoudig online op maat bestellen.
Alle niet stekplichtige onderdelen zoals scharnieren, sloten, randverwarming en verlichting voor alle typen koelingen en vriezers.
https://koelcel-onderdelen.com


User avatar
Expert Member

Posts

Joined
Sat Jun 25, 2011 4:09 am
Location - Alkmaar Holland

Post by Weiqunw » Sat Oct 10, 2015 5:15 pm

Yeah I did google and find those answers for changing mysql to mysqli... offcourse that I first try to google it then I'm asking on the forum.

But my config db driver was already on mysqli even on the php 5.3 server.. so thats why i'm asking how is this possible. 100% sure about this.

Both config.php and admin/config.php are already on mysqli.
Also cleaned the system cache and vqmod cache with no results.

Active Member

Posts

Joined
Wed Jul 10, 2013 3:29 pm
Location - Arnhem, the Netherlands

Post by IP_CAM » Sat Oct 10, 2015 8:22 pm

Just a wild guess:
I would de-activate VqMod, as long as it does not work. It's easier to find problems, if some should exist.
To do this, you should temporarely remove this in your BOTH index.php:

Code: Select all

// VirtualQMOD
require_once('./vqmod/vqmod.php');
VQMod::bootup();

// VQMODDED Startup
require_once(VQMod::modCheck(DIR_SYSTEM . 'startup.php'));

// Application Classes
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/customer.php'));
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/affiliate.php'));
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/currency.php'));
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/tax.php'));
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/weight.php'));
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/length.php'));
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/cart.php'));
----
admin
----
//VirtualQMOD
require_once('../vqmod/vqmod.php');
VQMod::bootup();

// VQMODDED Startup
require_once(VQMod::modCheck(DIR_SYSTEM . 'startup.php'));

// Application Classes
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/currency.php'));
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/user.php'));
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/weight.php'));
require_once(VQMod::modCheck(DIR_SYSTEM . 'library/length.php'));
just to make sure, that No VqMod-related 'function' possibly looks for
something, related to MySql instead of MySqli.

Ernie

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by Weiqunw » Mon Oct 12, 2015 5:04 pm

It was indeed caused by a VqMod!
Line 117 in system/startup.php was this line:

mysql_select_db(DB_DATABASE) or die("Unable to select database");

From the Vqmod file with this mysql connection:

Code: Select all

// Common

$db2 = mysql_connect( DB_HOSTNAME, DB_USERNAME, DB_PASSWORD) or die("Unable to connect to database");
	mysql_select_db(DB_DATABASE) or die("Unable to select database");
// Settings
 $sql = "SELECT * FROM " . DB_PREFIX . "setting where `key` in ('product_shipping_limit','mix_cart_shipping','conflict_cart_shipping','force_shipping_methods')";
$query =mysql_query($sql) or die(mysql_error());
 	$psl = 0;$mcs = 0;$ccs = 0;$fsm = 0;
	while($setting = mysql_fetch_assoc($query)){
	if( $setting['key']=='product_shipping_limit')
	$psl =  $setting['value'];
	
	if( $setting['key']=='mix_cart_shipping')
	$mcs =  $setting['value'];
	if( $setting['key']=='conflict_cart_shipping')
	$ccs =  $setting['value'];
	if( $setting['key']=='force_shipping_methods')
	$fsm =  $setting['value'];
}
Now I have to change this to mysqli.

Thanks for thinking with me!
Last edited by Weiqunw on Mon Oct 12, 2015 8:20 pm, edited 1 time in total.

Active Member

Posts

Joined
Wed Jul 10, 2013 3:29 pm
Location - Arnhem, the Netherlands

Post by Weiqunw » Mon Oct 12, 2015 8:19 pm

It is fixed!

To make the connection work in mysqli I had to add/change a few things

the lines with mysql to mysqli, so mysqli_connect

add $db2 to the mysqli_select_db
add $db2 to the mysqli_query

Like this:

Code: Select all

$db2 = mysqli_connect( DB_HOSTNAME, DB_USERNAME, DB_PASSWORD) or die("Unable to connect to database");
mysqli_select_db($db2, DB_DATABASE) or die("Unable to select database");
		
// Settings
$sql = "SELECT * FROM " . DB_PREFIX . "setting where `key` in ('product_shipping_limit','mix_cart_shipping','conflict_cart_shipping','force_shipping_methods')";
$query =mysqli_query($db2, $sql) or die(mysqli_error($db2));
$psl = 0;$mcs = 0;$ccs = 0;$fsm = 0;
while ($setting = mysqli_fetch_assoc($query)){

Active Member

Posts

Joined
Wed Jul 10, 2013 3:29 pm
Location - Arnhem, the Netherlands
Who is online

Users browsing this forum: No registered users and 3 guests