【问题标题】:Is it possible to force error reporting through LAMP?是否可以通过 LAMP 强制错误报告?
【发布时间】:2013-06-17 15:11:43
【问题描述】:

如果需要,我会保持简单并添加详细信息。

我有一些客户只是喜欢在任何地方添加随机文件......即:在网站中有 20 个 .htaccess 文件。

我知道正确的方法是:清理网站并只发布 1 个 htaccess 文件。

但是,我并不总是有时间。

是否可以在 LAMP 中设置默认的“报告所有错误,忽略有关此事的其他说明”。

我认为既然是本地开发,没有明显的理由隐藏错误。

我在根文件夹中尝试了以下 .htaccess 文件(以及其他一些变体),但效果不佳:

php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_value display_errors On
php_value error_reporting E_ALL

框架禁用它们。

其他文件会覆盖它们。

其他事情可能发生也可能不会发生。 - 总是有其他东西 -_-' .

#

第一次编辑 :: 为我工作。

#

文件位置:/etc/php5/apache2/php.ini

修改的行:

display_errors = On
error_reporting = E_ALL
user_ini.filename = ".user.ini"

从终端:

service apache2 restart

【问题讨论】:

  • if ( file_exists('.htaccess') && is_writeable('.htaccess') ) unlink('.htaccess');
  • 目前正在查看 Salketer 的答案。似乎 php.ini 将是要走的路。一旦我开始工作,我会更新我编辑的行。
  • 严格模式不会这样做。将它应用到由客户加扰的框架中是地狱并留下痕迹。 >> 使用 Salketer 的参考资料解决了我的问题。谢谢

标签: php error-handling lamp


【解决方案1】:

由于有很多类似的重复,我将发布我使用的简单解决方案。

文件位置:/etc/php5/apache2/php.ini

修改的行:

display_errors = On
error_reporting = E_ALL
user_ini.filename = ".user.ini"

从终端:

service apache2 restart

【讨论】:

    猜你喜欢
    • 2021-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多