在没有php.ini的情况下设置display_errors = 0和log_errors = 1 [英] Setting display_errors=0 and log_errors=1 without php.ini

查看:502
本文介绍了在没有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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆