PHP发射上的错误500 - 这哪里是记录? [英] PHP emitting 500 on errors - where is this documented?

查看:139
本文介绍了PHP发射上的错误500 - 这哪里是记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在<一个href=\"http://stackoverflow.com/questions/3075174/how-to-make-php-set-http-status-$c$c-to-500-automatically-in-case-of-any-error-co\">this 中的OP问题提到PHP自动抛出一个500错误,当的error_reporting 关闭,和Xdebug改变这种行为。

In this question the OP mentions PHP throwing a 500 error automatically when error_reporting is off, and XDebug changing that behaviour.

这让我好奇,因为我从来没有听说过的PHP前自动发射500秒。据对SO和其他地方不同的报价和答案,这似乎确实是PHP的默认行为抛出一个 500内部服务器错误头,如果的display_errors 设置为false。

That got me curious, as I've never heard of PHP automatically emitting 500s before. According to various quotes and answers on SO and elsewhere, it seems to indeed be PHP's default behaviour to throw a 500 Internal Server Error header if display_errors is set to false.

不过,我无法找到这样的东西官员。在的display_errors手册页并的error_reporting 什么也不说。

However, I am unable to find anything official on this. The manual pages on display_errors and error_reporting say nothing.

有谁知道在谈到这个PHP文档的良好来源?

Does anybody know a good source in the PHP docs that talks about this?

推荐答案

不知道,但是这可能是的在PHP 5.2.4添加

Not sure, but this may have been added in PHP 5.2.4:


      
  • 改变错误处理程序来发送HTTP 500,而不是空白页上的PHP错误。 (德米特里·安德烈Nigmatulin)

  •   

有也对内部列表这可能是相关的讨论

There is also this discussion on the internals list that might be related:

  • [PHP-DEV] FW: php fastcgi

引用

当前时间大多数P​​HP instalations使用设置'display_error = 0。
  此设置从用户隐藏了错误,但可向他只是一个空白页。

Current time most PHP instalations use setting 'display_error=0'. This setting hides errors from user but may send to him just a blank page.

建议的补丁发送上的错误,而不是空白页的HTTP 500响应。
  已经写的东西的网页并不affectd。

The proposed patch sends HTTP 500 response on errors instead of blank pages. The pages that already wrote something are not affectd.

任何异议或补充?

和建议的解决方案/补丁似乎如下所示:

and the proposed solution/patch seems to be shown here:

这篇关于PHP发射上的错误500 - 这哪里是记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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