【问题标题】:Opencart disable Mysql/Php Error DisplayOpencart 禁用 Mysql/Php 错误显示
【发布时间】: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


【解决方案1】:

您的 第一个解决方案 是正确的,并且应该执行必要的操作但是php.ini 中所做的任何更改都会在您重新启动服务器(根据我的经验,99% 的时间)。

我了解您当前正在使用共享服务器,您无法重新启动服务器,因此当我遇到类似情况时,我使用了 PHP Rintime Configuration (PHPRC) 来解决这个问题Dreamhost Web 托管服务提供商的问题。

您也可以联系您的托管服务提供商以了解如何实施 PHPRC。如果你想看看它是如何在 Dreamhost 中完成的,这里是链接:

PHPRC in Dreamhost.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-05-31
    • 2014-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多