PHP错误报告生产与开发 [英] PHP Error Reporting Production vs Development
本文介绍了PHP错误报告生产与开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在开发和生产应用程序上设置错误报告时的最佳实践是什么?目前,我有以下内容:
What is best practice when setting error reporting on development and production applications? At the moment I have the following:
// development
error_reporting(E_ALL);
// production
ini_set('display_errors', 0);
ini_set('log_errors', 1);
error_reporting(E_ERROR | E_WARNING | E_PARSE);
推荐答案
引用 php-production.ini 应该与您的PHP捆绑在一起:
Quoting the php-production.ini that should have come bundled with your PHP:
; PHP comes packaged with two INI files. One that is recommended to be used
; in production environments and one that is recommended to be used in
; development environments.
; php.ini-production contains settings which hold security, performance and
; best practices at its core. But please be aware, these settings may break
; compatibility with older or less security conscience applications. We
; recommending using the production ini in production and testing environments.
进一步
; display_errors
; Default Value: On
; Development Value: On
; Production Value: Off
; display_startup_errors
; Default Value: Off
; Development Value: On
; Production Value: Off
; error_reporting
; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
; Development Value: E_ALL
; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
; html_errors
; Default Value: On
; Development Value: On
; Production value: On
; log_errors
; Default Value: Off
; Development Value: On
; Production Value: On
由于您要求最佳实践,所以我建议您这样做.
Since you asked for best practise, I suggest you go with that.
这篇关于PHP错误报告生产与开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文