note 94308 added to function.header
| From: | guy dot paddockATgmailDOTcom at osu1 dot php dot net | Date: | Wed, 28 Oct 2009 16:01:43 +0000 |
| Subject: | note 94308 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-162183@lists.php.net to get a copy of this message | ||
It looks like I might have to revise what I said earlier...
In an environment where PHP is running under FastCGI, the following code:
<?php
header('HTTP', true, 403);
echo "Nothing to see here...\n";
?>
...produces a response with a status code of 500 and the following message in the page:
"403 Forbidden
The server encountered an internal error or misconfiguration and was unable to complete your
request.
Please contact the server administrator, webmaster@localhost and inform them of the time the error
occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log."
Yet, the following code does what the code above was trying to do (send back 403 with "Nothing
to see here..."):
<?php
header(' ', true, 403);
echo "Nothing to see here...\n";
?>
This also works:
<?php
header('Status: 403');
echo "Nothing to see here...\n";
?>
This might be a bug in FastCGI, since all three ways to send the response work the same way on the
exact same PHP version (5.2.11-0.dotdeb.0) running as an Apache module.
----
Server IP: 64.71.164.2
Probable Submitter: 129.21.225.247
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- https://master.php.net/note/edit/94308
Del: integrated -- https://master.php.net/note/delete/94308/integrated
Del: useless -- https://master.php.net/note/delete/94308/useless
Del: bad code -- https://master.php.net/note/delete/94308/bad+code
Del: spam -- https://master.php.net/note/delete/94308/spam
Del: non-english -- https://master.php.net/note/delete/94308/non-english
Del: in docs -- https://master.php.net/note/delete/94308/in+docs
Del: other reasons-- https://master.php.net/note/delete/94308
Reject -- https://master.php.net/note/reject/94308
Search -- https://master.php.net/manage/user-notes.php