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


基础教程推荐
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 如何替换eregi() 2022-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01