【发布时间】:2015-04-24 14:57:31
【问题描述】:
我已经尝试了互联网上的所有解决方案,但仍然无法解决。
问题 - Opencart 显示 Php/MySql 错误(也显示用于连接 mysql 的密码)
当 Opencart 在连接 MySql 数据库时遇到任何问题或由于连接过多 php 无法连接到数据库时,会显示以下格式的错误。
警告:mysqli::mysqli(): (28000/1045): 拒绝用户访问 'indiaran_admin'@'localhost'(使用密码:YES) /home3/indiaran/public_html/system/database/mysqli.php 在第 6 行
致命错误:未捕获的异常“ErrorException”和消息“错误: 无法建立数据库链接' /home3/indiaran/public_html/system/database/mysqli.php:9 堆栈跟踪:#0 /home3/indiaran/public_html/vqmod/vqcache/vq2-system_library_db.php(13): DBMySQLi->__construct('localhost', 'indiaran_admin', 'PASSWORD', 'indiaran_db') #1 /home3/indiaran/public_html/index.php(44): DB->__construct('mysqli', 'localhost', 'indiaran_admin', 'PASSWORD', 'indiaran_db') #2 {main} 投入 /home3/indiaran/public_html/system/database/mysqli.php 在第 9 行
预期的解决方案:-(任何都可以)
- Opencart 停止显示任何错误 Mysql/php
- 显示错误,但未显示我的数据库 ID 和密码。
- 任何停止显示所有错误(包括 mysqli 连接错误)的解决方案
尝试的解决方案:-
第一
php.ini has
display_errors = Off;
error_reporting = 0;
htaccess has
php_value error_reporting 0
第二
There is a setting within the OpenCart dashboard that allows you to turn on (or off) error reporting and logging.
Log into your dashboard
In the menu, go to "System" and select "Settings"
In the list of stores, click "Edit" for your store
Click the "Server" tab.
Scroll down, and there's two settings:
a. Log Errors - set this as desired
b. Display Errors - set this to "No"
第三
Commenting Out set_error_handler('error_handler'); in index.php
第四
Using Php Try-Catch Phrase, which i dont know exactly how to use in opencart.
希望我能解释一下自己,有人能帮助我。
PS:- 我的网站使用 Hostgator 作为共享主机托管。
无法解决我的问题的类似问题的链接。
http://stackoverflow.com/questions/16935473/cant-disable-error-reporting-in-opencart-php
http://stackoverflow.com/questions/5040048/php-mysql-too-many-connections-to-database-error
http://stackoverflow.com/questions/25957024/warning-mysqlimysqli-mysqli-mysqli-08004-1040-too-many-connections-in
http://stackoverflow.com/questions/28591394/mysqli-connect-error-shows-password/28591455#28591455
【问题讨论】:
-
如果您已经在此处接受了有关同一主题的问题的答案,再次询问的原因是什么:stackoverflow.com/questions/28591394/…???
-
我接受了这个答案,因为这帮助我解决了所有问题,但在 opencart 方面却没有,因为在 opencart 方面似乎没有任何效果:/
标签: php mysql sql mysqli opencart