Still necessary to use 'Status: 404 Not Found' for FCGI?

爱⌒轻易说出口 提交于 2019-12-01 06:02:14

I don't believe you need to use the 'Status' style header unless you have the option cgi.rfc2616_headers enabled.

The description of that option is http://php.net/manual/en/ini.core.php

"Tells PHP what type of headers to use when sending HTTP response code. If it's set 0, PHP sends a Status: header that is supported by Apache and other web servers. When this option is set to 1, PHP will send » RFC 2616 compliant headers. Leave it set to 0 unless you know what you're doing."

Basically you're sending HTTP style headers to PHP and then PHP converts these to the 'Status' style headers where necessary. It seems there were various bugs over the years where either these were either converted incorrectly or multiple 'Status' headers were sent at once - however all those bugs seem to be fixed now. So I think you're safe just setting the HTTP style headers and letting PHP convert them.

Also I just tested and sending the header("HTTP/1.0 404 Not Found"); works fine on my dev environment using FastCGI

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!