Warning: mysqli::mysqli() [mysqli.mysqli]: (08004/

2019-09-15 19:07发布

问题:

This question already has an answer here:

  • php, mysql - Too many connections to database error 6 answers

Guys i am having errors in my opencart website, but actually the problem is that this error also displays my database login and password. How can i fix this problem.

The error raised is like

Fatal error: Uncaught exception "ErrorException" with message "Error: Could not make a database link (1040) Too many connections" in /home/*******/public_html/system/database/mysqli.php:9 Stack trace: #0 /home//*******//public_html/vqmod/vqcache/vq2-system_library_db.php(13): DBMySQLi->__construct("localhost", "/*******/", "/*******/", "*******") #1 /home/******/public_html/index.php(46): DB->__construct("mysqli", "localhost", "/*******/", "/*******/", "/*******/") #2 {main} thrown in /home/*******/public_html/system/database/mysqli.php on line 9

OpenCart Version 1.5.6.1

回答1:

To address the most pressing issue: in production environments you should turn off error reporting.

There are some configuration settings you need to look into:

error_reporting: http://php.net/manual/en/function.error-reporting.php

display_errors: http://php.net/manual/en/errorfunc.configuration.php#ini.display-errors

For safety's sake, you should probably change your database password as well. Even if no one has seen it, it's not worth the risk.

There are numerous questions on SO about the too many connections issue. Here's one quite well upvoted answer: php, mysql - Too many connections to database error