Post by garrie007 » Fri Apr 12, 2019 1:39 am

Hi All,

I am receiving this error message in v3.0.31

Code: Select all

2019-04-10 4:40:45 - PHP Warning:  DB\MySQLi::__construct(): Couldn't fetch mysqli in /home/1/dbxxxxxx/htdocs/clickandbuilds/OpenCart/xxxx/system/library/db/mysqli.php on line 10
this is a fresh install but I have no idea on php programming only c#

any help very much appreciated.

Regards
Last edited by straightlight on Mon Apr 13, 2020 3:43 am, edited 1 time in total.
Reason: Added code tags.

New member

Posts

Joined
Mon Apr 08, 2019 5:39 am

Post by straightlight » Fri Apr 12, 2019 6:02 am

Ensure your database configuration account settings are properly configured in your config.php and admin/config.php files. Also check in your host console for all table permissions in your database to have write access.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by garrie007 » Fri Apr 12, 2019 6:15 am

Hi,

I have made the changes in admin/config.php

do I have to make changes to this piece of code as well in the system/lib/db/mysqli.php

Code: Select all

final class MySQLi {
	private $connection;

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

		if ($this->connection->connect_error) {
			throw new \Exception('Error: ' . $this->connection->error . '<br />Error No: ' . $this->connection->errno);
		}

		$this->connection->set_charset("utf8");
		$this->connection->query("SET SQL_MODE = ''");
	}

Regards

New member

Posts

Joined
Mon Apr 08, 2019 5:39 am

Post by straightlight » Fri Apr 12, 2019 6:27 am

No. Simply on the config files; in addition to create your database prior to OC installations.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by garrie007 » Fri Apr 12, 2019 6:40 am

straightlight wrote:
Fri Apr 12, 2019 6:27 am
No. Simply on the config files; in addition to create your database prior to OC installations.
I have made the db connection changes and hopefully it will be ok, thank you very much for your help.

Regards

New member

Posts

Joined
Mon Apr 08, 2019 5:39 am

Post by parkookk » Mon Mar 16, 2020 8:58 pm

I have the identical issue, how can I check my host database permissions?

Active Member

Posts

Joined
Thu Jan 17, 2013 11:56 pm
Location - london

Post by straightlight » Tue Mar 17, 2020 3:18 am

parkookk wrote:
Mon Mar 16, 2020 8:58 pm
I have the identical issue, how can I check my host database permissions?
Under your cPanel > Databases icon.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by parkookk » Tue Mar 17, 2020 11:19 pm

straightlight wrote:
Tue Mar 17, 2020 3:18 am
parkookk wrote:
Mon Mar 16, 2020 8:58 pm
I have the identical issue, how can I check my host database permissions?
Under your cPanel > Databases icon.
Thanks, all permissions are ticked, how can I get this error sorted?

Active Member

Posts

Joined
Thu Jan 17, 2013 11:56 pm
Location - london

Post by letxobnav » Tue Mar 17, 2020 11:50 pm

double check your config database settings

// DB
define('DB_DRIVER', 'mysqli');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'xxx');
define('DB_PASSWORD', 'xxx');
define('DB_DATABASE', 'xxx');
define('DB_PORT', '3306');
define('DB_PREFIX', 'xxx_');

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by w3creators » Mon Apr 13, 2020 2:45 am

straightlight wrote:
Fri Apr 12, 2019 6:27 am
No. Simply on the config files; in addition to create your database prior to OC installations.
I am also getting the same error. I sure mysqli database connection is correct and my website is working. But I am getting this error in error log file in cpanel. Kindly give me some solutions.

J P Senthil Kumar
Freelancer Web Designer & Developer, WhatsApp : +91 9952012075, Skype: jpsnifty.


Newbie

Posts

Joined
Mon Jul 31, 2017 1:46 pm
Location - Chennai, India

Post by straightlight » Mon Apr 13, 2020 3:44 am

jpsnifty wrote:
Mon Apr 13, 2020 2:45 am
straightlight wrote:
Fri Apr 12, 2019 6:27 am
No. Simply on the config files; in addition to create your database prior to OC installations.
I am also getting the same error. I sure mysqli database connection is correct and my website is working. But I am getting this error in error log file in cpanel. Kindly give me some solutions.
Please post both config files without password information.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by w3creators » Mon Apr 13, 2020 3:55 am

straightlight wrote:
Mon Apr 13, 2020 3:44 am
jpsnifty wrote:
Mon Apr 13, 2020 2:45 am
straightlight wrote:
Fri Apr 12, 2019 6:27 am
No. Simply on the config files; in addition to create your database prior to OC installations.
I am also getting the same error. I sure mysqli database connection is correct and my website is working. But I am getting this error in error log file in cpanel. Kindly give me some solutions.
Please post both config files without password information.
My config details :

Code: Select all

<?php 
// HTTP
define('HTTP_SERVER', 'https://mywebsite.sg/');

// HTTPS
define('HTTPS_SERVER', 'https://mywebsite.sg/');

// DIR
define('DIR_APPLICATION', '/home/mywebsite/public_html/catalog/');
define('DIR_SYSTEM', '/home/mywebsite/public_html/system/');
define('DIR_IMAGE', '/home/mywebsite/public_html/image/');
define('DIR_STORAGE', '/home/mywebsite/public_html/storage/');
define('DIR_LANGUAGE', DIR_APPLICATION . 'language/');
define('DIR_TEMPLATE', DIR_APPLICATION . 'view/theme/');
define('DIR_CONFIG', DIR_SYSTEM . 'config/');
define('DIR_CACHE', DIR_STORAGE . 'cache/');
define('DIR_DOWNLOAD', DIR_STORAGE . 'download/');
define('DIR_LOGS', DIR_STORAGE . 'logs/');
define('DIR_MODIFICATION', DIR_STORAGE . 'modification/');
define('DIR_SESSION', DIR_STORAGE . 'session/');
define('DIR_UPLOAD', DIR_STORAGE . 'upload/');

// DB
define('DB_DRIVER', 'mysqli');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'britishi_british');
define('DB_PASSWORD', 'mypassword');
define('DB_DATABASE', 'britishi_british');
define('DB_PORT', '3306');
define('DB_PREFIX', 'oc_');
----------------------------------------------------------------------------------------
Admin config details : 

<?php
// HTTP
define('HTTP_SERVER', 'https://mywebsite.sg/admin2/');
define('HTTP_CATALOG', 'https://mywebsite.sg/');

// HTTPS
define('HTTPS_SERVER', 'https://mywebsite.sg/admin2/');
define('HTTPS_CATALOG', 'https://mywebsite.sg/');

// DIR
define('DIR_APPLICATION', '/home/mywebsite/public_html/admin2/');
define('DIR_SYSTEM', '/home/mywebsite/public_html/system/');
define('DIR_IMAGE', '/home/mywebsite/public_html/image/');
define('DIR_STORAGE', '/home/mywebsite/public_html/storage/');
define('DIR_CATALOG', '/home/mywebsite/public_html/catalog/');
define('DIR_LANGUAGE', DIR_APPLICATION . 'language/');
define('DIR_TEMPLATE', DIR_APPLICATION . 'view/template/');
define('DIR_CONFIG', DIR_SYSTEM . 'config/');
define('DIR_CACHE', DIR_STORAGE . 'cache/');
define('DIR_DOWNLOAD', DIR_STORAGE . 'download/');
define('DIR_LOGS', DIR_STORAGE . 'logs/');
define('DIR_MODIFICATION', DIR_STORAGE . 'modification/');
define('DIR_SESSION', DIR_STORAGE . 'session/');
define('DIR_UPLOAD', DIR_STORAGE . 'upload/');

// DB
define('DB_DRIVER', 'mysqli');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'britishi_british');
define('DB_PASSWORD', 'mypassword');
define('DB_DATABASE', 'britishi_british');
define('DB_PORT', '3306');
define('DB_PREFIX', 'oc_');

// OpenCart API
define('OPENCART_SERVER', 'https://www.opencart.com/');
Last edited by straightlight on Mon Apr 13, 2020 5:59 am, edited 1 time in total.
Reason: Added code tags.

J P Senthil Kumar
Freelancer Web Designer & Developer, WhatsApp : +91 9952012075, Skype: jpsnifty.


Newbie

Posts

Joined
Mon Jul 31, 2017 1:46 pm
Location - Chennai, India

Post by letxobnav » Mon Apr 13, 2020 10:52 am

I sure mysqli database connection is correct and my website is working.
Then you (or one of your extensions) is probably closing the DB connection before they should.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by w3creators » Thu Apr 16, 2020 12:35 am

letxobnav wrote:
Mon Apr 13, 2020 10:52 am
I sure mysqli database connection is correct and my website is working.
Then you (or one of your extensions) is probably closing the DB connection before they should.
Sir, thank you for your valuable reply. I have installed some extensions but how to find which extension is causing this issue. I am opencart 3.0.2.0.
--------------------------------------------

J P Senthil Kumar
Freelancer Web Designer & Developer, WhatsApp : +91 9952012075, Skype: jpsnifty.


Newbie

Posts

Joined
Mon Jul 31, 2017 1:46 pm
Location - Chennai, India
Who is online

Users browsing this forum: No registered users and 4 guests