Best way to suppress php errors on production servers(在生产服务器上抑制 php 错误的最佳方法)
问题描述
在浏览器上隐藏 php 错误的最佳方法是什么?
What is the best method of hiding php errors from being displayed on the browser?
是否会使用以下内容:
ini_set("display_errors", 1);
任何最佳实践提示也将不胜感激!
Any best practice tips would be appreciated as well!
我正在记录错误,我只是想确保将 display_errors 值设置为 off(或 0)不会阻止记录错误.
I am logging the errors, I just want to make sure that setting the display_errors value to off (or 0) will not prevent errors from being logged.
推荐答案
最好的方法是记录您的错误,而不是显示或忽略它们.
The best way is to log your errors instead of displaying or ignoring them.
此示例会将错误记录到系统日志中,而不是在浏览器中显示它们.
This example will log the errors to syslog instead of displaying them in the browser.
ini_set("display_errors", 0);
ini_set("log_errors", 1);
//Define where do you want the log to go, syslog or a file of your liking with
ini_set("error_log", "syslog"); // or ini_set("error_log", "/path/to/syslog/file");
这篇关于在生产服务器上抑制 php 错误的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在生产服务器上抑制 php 错误的最佳方法
基础教程推荐
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 如何替换eregi() 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
