Screenshot is here, https://img.hostek.net/i/9f93cb14c4e0c708d2aa
Is there an easy fix? Is there a straight line to update to a newer version of OpenCart?
The error comes from the used and outdated MySQL!dbodemer wrote: ↑Mon Sep 21, 2020 7:46 amHello, I have an older version of opencart running. I'm getting the following error.
Screenshot is here, https://img.hostek.net/i/9f93cb14c4e0c708d2aa
Is there an easy fix? Is there a straight line to update to a newer version of OpenCart?
Deprecated and should not used anymore.
Use MySQLi instead which is the de-facto standard these days (if MySQL is used and not another database driver).
Because you are not writing which OpenCart version you are using (old is good, but how old ..?) and which php-version, giving a solution is not that easy für an update.
Updates can be made basically from every version, but it depends on the old and the new version how it shall and should be made.
To try it by yourself, download the latest version either from the 2.x branch (therefore 2.3.0.2) or 3.x (then 3.0.3.6) install it new in a seperate folder and migrate your database manually.
This is the safiest and cheapest way to do an Update.
Do not use the standard upgrade routine, because this will bring you more troubles you might expect!
Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.
https://www.opencart.com/index.php?rout ... load_id=36
Or then use the file I use ( shown below, v.1.5.6.x ), to enable mysqli
---
Then, change in BOTH of your config.php Files ( Front + Admin )
This Line:
Code: Select all
// DB
define('DB_DRIVER', 'mysql');
Code: Select all
// DB
define('DB_DRIVER', 'mysqli');
system/database/mysqli.php
Code: Select all
<?php
final class DBMySQLi {
private $link;
public function __construct($hostname, $username, $password, $database) {
$this->link = new mysqli($hostname, $username, $password, $database);
if (mysqli_connect_error()) {
trigger_error('Error: Could not make a database link (' . $this->link->connect_errno . ') ' . $this->link->connect_error);
exit();
}
$this->link->set_charset("utf8");
$this->link->query("SET SQL_MODE = ''");
}
public function query($sql) {
$query = $this->link->query($sql);
if (!$this->link->errno){
if (isset($query->num_rows)) {
$data = array();
while ($row = $query->fetch_assoc()) {
$data[] = $row;
}
$result = new stdClass();
$result->num_rows = $query->num_rows;
$result->row = isset($data[0]) ? $data[0] : array();
$result->rows = $data;
unset($data);
$query->close();
return $result;
} else{
return true;
}
} else {
trigger_error('Error: ' . $this->link->error . '<br />Error No: ' . $this->link->errno . '<br />' . $sql);
exit();
}
}
public function escape($value) {
return $this->link->real_escape_string($value);
}
public function countAffected() {
return $this->link->affected_rows;
}
public function getLastId() {
return $this->link->insert_id;
}
public function __destruct() {
$this->link->close();
}
}
?>
Ernie
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
Here is the actual message in the logs.
[21-Mar-2019 09:26:55 America/Chicago] PHP Notice: Use of undefined constant DIR_SYSTEM - assumed 'DIR_SYSTEM' in /home/mindourb/public_html/ocart/system/startup.php on line 77
[21-Mar-2019 09:26:55 America/Chicago] PHP Warning: require_once(DIR_SYSTEMhelper/json.php): failed to open stream: No such file or directory in /home/mindourb/public_html/ocart/system/startup.php on line 77
[21-Mar-2019 09:26:55 America/Chicago] PHP Fatal error: require_once(): Failed opening required 'DIR_SYSTEMhelper/json.php' (include_path='.:/opt/alt/php56/usr/share/pear:/opt/alt/php56/usr/share/php') in /home/mindourb/public_html/ocart/system/startup.php on line 77
should rather look like:
require_once(DIR_SYSTEM/helper/json.php)
you may have mistyped a link or path in a file, where that JSON Link exists,
and NOT added a forward SLASH '/' ...
Check your system/startup.php file on this, the problem itself might be
located in the config.php File, where that forward slash might be missing.
it should look like this:
define('DIR_SYSTEM', '/home/site/www/yoursite/shop/system/');
and NOT like this:
define('DIR_SYSTEM', '/home/site/www/yoursite/shop/system');
( PS: All those config.php Path-Lines require an ending forward SLASH! )
---
Usually, one can find the Version Number in the index.php file:
// Version
define('VERSION', '1.5.6.5 LIGHT');
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
forward SLASH to those lines in the config.php File, like:
// HTTP
define('HTTP_SERVER', 'http://www.openshop.li/shop/');
// HTTPS
define('HTTPS_SERVER', 'http://www.openshop.li/shop/');
still, that should not matter, when it comes to 'internal' linking ...
Good Luck!
Ernie
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
<?php
// HTTP
define('HTTP_SERVER', 'http://www.mindourbeeswax.com/ocart/');
// HTTPS
define('HTTPS_SERVER', 'http://wwww.mindourbeeswax.com/ocart/');
// DIR
define('DIR_APPLICATION', '/home/mindourb/public_html/ocart/catalog/');
define('DIR_SYSTEM', '/home/mindourb/public_html/ocart/system/');
define('DIR_DATABASE', '/home/mindourb/public_html/ocart/system/database/');
define('DIR_LANGUAGE', '/home/mindourb/public_html/ocart/catalog/language/');
define('DIR_TEMPLATE', '/home/mindourb/public_html/ocart/catalog/view/theme/');
define('DIR_CONFIG', '/home/mindourb/public_html/ocart/system/config/');
define('DIR_IMAGE', '/home/mindourb/public_html/ocart/image/');
define('DIR_CACHE', '/home/mindourb/public_html/ocart/system/cache/');
define('DIR_DOWNLOAD', '/home/mindourb/public_html/ocart/download/');
define('DIR_LOGS', '/home/mindourb/public_html/ocart/system/logs/');
// DB
define('DB_DRIVER', 'mysqli');
Thanks for all the help everyone.
[22-Sep-2020 09:42:30 America/Chicago] PHP Warning: mysqli::mysqli(): (42000/1044): Access denied for user 'mindourb_ocar806'@'localhost' to database 'mindourb_ocar806' in /home/mindourb/public_html/ocart/system/library/db.php on line 12
[22-Sep-2020 09:42:30 America/Chicago] PHP Fatal error: Call to undefined method mysqli::escape() in /home/mindourb/public_html/ocart/system/library/db.php on line 20
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
For other may have the same problem, it would be nice if you could post the solution here.
Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.
Users browsing this forum: No registered users and 214 guests