Post by Alexandra Ionela » Thu Jul 02, 2015 5:37 pm

Hello world! I decided to move my site based on OpenCart 1.5.6.4 from "Live Server" to XAMPP 5.6.8.0 to make changes in store in safety. So I've started to work....

1. I made a backup of all the files from public_html to a folder,
2. I made a backup of the databese from PHP my Admin (live srever) to my Desktop,
3. I copy/paste all the files from "public_html" into the Local Disk (C:)/xampp/htdocs/opencart folder,
4. I imported the database into PHP my Admin (XAMPP),
5. I update configuration files in config.php & admin/config.php

and it gives me this error:

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in C:\xampp\htdocs\opencart\system\database\mysql.php on line 11

Warning: mysql_connect(): Access denied for user 'domain_dbopenc'@'localhost' (using password: YES) in C:\xampp\htdocs\opencart\system\database\mysql.php on line 11

Notice: Error: Could not make a database link using domain_dbopenc@localhost in C:\xampp\htdocs\opencart\system\database\mysql.php on line 13

Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in C:\xampp\htdocs\opencart\system\database\mysql.php on line 19

Notice: Error: Could not connect to database domain_dbopenc in C:\xampp\htdocs\opencart\system\database\mysql.php on line 21

Warning: mysql_query() expects parameter 2 to be resource, boolean given in C:\xampp\htdocs\opencart\system\database\mysql.php on line 27

Warning: mysql_query() expects parameter 2 to be resource, boolean given in C:\xampp\htdocs\opencart\system\database\mysql.php on line 29

Warning: mysql_query() expects parameter 2 to be resource, boolean given in C:\xampp\htdocs\opencart\system\database\mysql.php on line 31

Warning: mysql_query() expects parameter 2 to be resource, boolean given in C:\xampp\htdocs\opencart\system\database\mysql.php on line 33

Notice: Trying to get property of non-object in C:\xampp\htdocs\opencart\index.php on line 103

Notice: Trying to get property of non-object in C:\xampp\htdocs\opencart\index.php on line 121

Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\opencart\index.php on line 121

Notice: Trying to get property of non-object in C:\xampp\htdocs\opencart\index.php on line 137



Is it there anyone to help me solve this problem? Thank you in advance!


Posts

Joined
Fri Aug 01, 2014 1:26 am

Post by deepvision » Thu Jul 02, 2015 9:39 pm

On your local server there is a newer php version.
If you want to keep it you should configure your OC to work with mysqli instead of mysql.
Try changing the config.php (both front end and admin):

Code: Select all

define('DB_DRIVER', 'mysqli');

ImageImageImage


User avatar
Active Member

Posts

Joined
Tue May 19, 2015 1:03 am

Post by Alexandra Ionela » Thu Jul 02, 2015 10:40 pm

Thank you mr. deepvision. But were can i find these lines ?

is this 1 of it?

C:\xampp\htdocs\opencart\system\database\mysql.php on line 11 as the error says?


if (!$this->link = mysql_connect($hostname, $username, $password)) {

trigger_error('Error: Could not make a database link using ' . $username . '@' . $hostname);

}


and I must edit it like this ?!? ...


if (!$this->link = mysqli_connect($hostname, $username, $password)) {

trigger_error('Error: Could not make a database link using ' . $username . '@' . $hostname);

}

and the other, where can I find it? Thank you!


Posts

Joined
Fri Aug 01, 2014 1:26 am

Post by deepvision » Fri Jul 03, 2015 12:25 am

But I wrote what files you had to edit: config.php in the root and in the admin folder.

ImageImageImage


User avatar
Active Member

Posts

Joined
Tue May 19, 2015 1:03 am

Post by Alexandra Ionela » Fri Jul 03, 2015 2:42 am

I edited those files, and the error is still there...

<?php
// HTTP
define('HTTP_SERVER', 'http://localhost/opencart/');

// HTTPS
define('HTTPS_SERVER', 'http://localhost/opencart/');

// DIR
define('DIR_APPLICATION', 'C:\xampp\htdocs\opencart/catalog/');
define('DIR_SYSTEM', 'C:\xampp\htdocs\opencart/system/');
define('DIR_DATABASE', 'C:\xampp\htdocs\opencart/system/database/');
define('DIR_LANGUAGE', 'C:\xampp\htdocs\opencart/catalog/language/');
define('DIR_TEMPLATE', 'C:\xampp\htdocs\opencart/catalog/view/theme/');
define('DIR_CONFIG', 'C:\xampp\htdocs\opencart/system/config/');
define('DIR_IMAGE', 'C:\xampp\htdocs\opencart/image/');
define('DIR_CACHE', 'C:\xampp\htdocs\opencart/system/cache/');
define('DIR_DOWNLOAD', 'C:\xampp\htdocs\opencart/download/');
define('DIR_LOGS', 'C:\xampp\htdocs\opencart/system/logs/');

// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'shop_db');
define('DB_PASSWORD', '1234567890');
define('DB_DATABASE', 'store_db');
define('DB_PREFIX', 'oc_db');
?>


and:



<?php
// HTTP
define('HTTP_SERVER', 'http://localhost/opencart/admin/');
define('HTTP_CATALOG', 'http://localhost/opencart/');

// HTTPS
define('HTTPS_SERVER', 'http://localhost/opencart/admin/');
define('HTTPS_CATALOG', 'http://localhost/opencart/');

// DIR
define('DIR_APPLICATION', 'C:/xampp/htdocs/opencart/admin/');
define('DIR_SYSTEM', 'C:/xampp/htdocs/opencart/system/');
define('DIR_DATABASE', 'C:/xampp/htdocs/opencart/system/database/');
define('DIR_LANGUAGE', 'C:/xampp/htdocs/opencart/admin/language/');
define('DIR_TEMPLATE', 'C:/xampp/htdocs/opencart/admin/view/template/');
define('DIR_CONFIG', 'C:/xampp/htdocs/opencart/system/config/');
define('DIR_IMAGE', 'C:/xampp/htdocs/opencart/image/');
define('DIR_CACHE', 'C:/xampp/htdocs/opencart/system/cache/');
define('DIR_DOWNLOAD', 'C:/xampp/htdocs/opencart/download/');
define('DIR_LOGS', 'C:/xampp/htdocs/opencart/system/logs/');
define('DIR_CATALOG', 'C:/xampp/htdocs/opencart/catalog/');

// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'shop_db');
define('DB_PASSWORD', '1234567890');
define('DB_DATABASE', 'store_db');
define('DB_PREFIX', 'oc_db');
?>


these are the settings.


Posts

Joined
Fri Aug 01, 2014 1:26 am

Post by deepvision » Fri Jul 03, 2015 2:52 am

But I wrote you it should be:

Code: Select all

define('DB_DRIVER', 'mysqli');
Not as it is in your config

Code: Select all

define('DB_DRIVER', 'mysql');

ImageImageImage


User avatar
Active Member

Posts

Joined
Tue May 19, 2015 1:03 am

Post by Alexandra Ionela » Fri Jul 03, 2015 4:06 am

ahhh sorry. I modified with "mysqli" and it give me this:

Warning: mysqli::mysqli(): (HY000/1045): Access denied for user 'shop_db'@'localhost' (using password: YES) in C:\xampp\htdocs\opencart\system\database\mysqli.php on line 6

Fatal error: Uncaught exception 'ErrorException' with message 'Error: Could not make a database link (1045) Access denied for user 'shop_db'@'localhost' (using password: YES)' in C:\xampp\htdocs\opencart\system\database\mysqli.php:9 Stack trace: #0 C:\xampp\htdocs\opencart\vqmod\vqcache\vq2-system_library_db.php(25): DBMySQLi->__construct('localhost', 'store_db...', '0123456789', 'shop_db...') #1 C:\xampp\htdocs\opencart\index.php(83): DB->__construct('mysqli', 'localhost', 'shop_db...', '0123456789', 'shop_db...') #2 {main} thrown in C:\xampp\htdocs\opencart\system\database\mysqli.php on line 9


Posts

Joined
Fri Aug 01, 2014 1:26 am

Post by deepvision » Fri Jul 03, 2015 4:12 am

All you have to do is to make sure you have correct settings in your config.php files.
These are related to the database error:

Code: Select all

define('DB_USERNAME', '<correct username>');
define('DB_PASSWORD', '<correct password>');
define('DB_DATABASE', '<correct database>');

ImageImageImage


User avatar
Active Member

Posts

Joined
Tue May 19, 2015 1:03 am

Post by Alexandra Ionela » Sat Jul 04, 2015 5:02 am

Thank you! I will try to look more carefull to see if is there anything wrong with the code. I'll come back as soon as possible with an answer. Thank you again!


Posts

Joined
Fri Aug 01, 2014 1:26 am
Who is online

Users browsing this forum: No registered users and 2 guests