记录php错误,但未在浏览器中显示 [英] logs php error but not display it in browser

查看:55
本文介绍了记录php错误,但未在浏览器中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建错误日志,但不想在浏览器中显示。

i want to create the error logs but not to display it in browser.

当前,当发生错误或警告/通知时,就会创建日志并出现错误显示给浏览器,但我想强制系统不向浏览器的站点访问者显示错误消息,而是为我创建日志。

Currently when an error or warning/notice is occurs, then logs is created and error is displayed to the browser but i want to force the system to not show the error message in browser to the site visitor but create the logs for me.

谢谢

推荐答案

请确保您的php.ini文件中包含以下内容:

Make sure you have something like this in your php.ini:

display_errors = Off
error_log = /var/log/php/error.log # Assuming you have /var/log/php directory and it's writable by httpd
error_reporting = E_ALL & ~E_DEPRECATED

或使用 ini_set()将它们设置为运行时选项

这篇关于记录php错误,但未在浏览器中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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