PHP 发出 500 错误 - 记录在哪里? [英] PHP emitting 500 on errors - where is this documented?

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

问题描述

这个问题 OP 提到当 error_reporting 关闭时 PHP 会自动抛出 500 错误,并且 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 和其他地方的各种引用和答案,如果 display_errors 设置为 false,则抛出 500 Internal Server Error 标头似乎确实是 PHP 的默认行为.

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_errorserror_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:

  • 更改了错误处理程序以在 PHP 错误时发送 HTTP 500 而不是空白页.(德米特里,安德烈·尼格马图林)

内部列表 可能是相关的:

引用:

大多数 PHP 安装使用设置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 响应.已经写过东西的页面不受影响.

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天全站免登陆