Setting display_errors=0 and log_errors=1 without php.ini(在没有 php.ini 的情况下设置 display_errors=0 和 log_errors=1)
问题描述
由于我无法控制的原因,我无法在我的生产服务器上的 php.ini 中设置 display_errors=0 和 log_errors=1.我知道我可以设置 error_reporting(0);
以完全抑制所有错误消息,但这会影响日志错误和显示的错误.我希望有一个等价于在运行时设置 display_errors=0 和 log_errors=1 .这可能吗?谢谢.
For reasons outside my control I am unable to set display_errors=0 and log_errors=1 in php.ini on my production server. I know I can set error_reporting(0);
to completely suppress all error messages, but this impacts both the log errors and the displayed errors. I was hoping there would be an equivalent to setting display_errors=0 and log_errors=1 at runtime. Is this possible? Thanks.
推荐答案
两者都是 PHP_INI_ALL
,所以你可以只使用 ini_set
在运行时.
Both are PHP_INI_ALL
, so you can just use ini_set
at runtime.
ini_set('display_errors', 0);
ini_set('log_errors', 1);
参见http://php.net/manual/en/ini.list.php
这篇关于在没有 php.ini 的情况下设置 display_errors=0 和 log_errors=1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在没有 php.ini 的情况下设置 display_errors=0 和 log_errors=1


基础教程推荐
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
- php中的foreach复选框POST 2021-01-01
- Yii2 - 在运行时设置邮件传输参数 2022-01-01
- Web 服务器如何处理请求? 2021-01-01
- php中的PDF导出 2022-01-01
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01
- php 7.4 在写入变量中的 Twig 问题 2022-01-01
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- 将变量从树枝传递给 js 2022-01-01