php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #32122 header("Status: 404 Not Found"); does not work
Submitted: 2005-02-26 23:08 UTC Modified: 2005-03-31 18:05 UTC
From: OvdSpek at LIACS dot NL Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5CVS-2005-03-01 OS: Linux, Windows XP, 2003
Private report: No CVE-ID:
 [2005-02-26 23:08 UTC] OvdSpek at LIACS dot NL
Description:
------------
I tried to use the code from the example, but it doesn't work. It appears the status header has been ignored completely.

http://php.net/header

GET /temp/404.php HTTP/1.0

HTTP/1.1 200 OK
Date: Sat, 26 Feb 2005 22:02:43 GMT
Server: Apache/2.0.53 (Win32) PHP/5.0.3
X-Powered-By: PHP/5.0.3
Status: 404 Not Found
Content-Length: 0
Connection: close
Content-Type: text/html; charset=ISO-8859-1


Reproduce code:
---------------
<?php
header("Status: 404 Not Found");
?>

Expected result:
----------------
HTTP/1.1 404 Not Found

Actual result:
--------------
HTTP/1.1 200 OK
Date: Sat, 26 Feb 2005 22:02:43 GMT
Server: Apache/2.0.53 (Win32) PHP/5.0.3
X-Powered-By: PHP/5.0.3
Status: 404 Not Found
Content-Length: 0
Connection: close
Content-Type: text/html; charset=ISO-8859-1


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-27 12:38 UTC] tony2001@php.net
The docs clearly state that this example is for PHP3 and you should use <? header("HTTP/1.0 404 Not Found"); ?> for versions >3.
Please check if it works fine for you.
 [2005-02-27 12:42 UTC] OvdSpek at LIACS dot NL
Where do the docs state that?

> Note: In PHP 3, this only works when PHP is compiled as an Apache module. You can achieve the same effect using the Status header. 

This states that if you're using PHP 3, it only works as Apache module.
It doesn't state that it only works in PHP 3.
 [2005-02-28 22:01 UTC] OvdSpek at LIACS dot NL
Will do. Just wondering, why did the summary change from header("Status: 404 Not Found"); doesn't work to Multiple small packets send for HTTP request?
 [2005-02-28 22:09 UTC] OvdSpek at LIACS dot NL
:(

GET /temp/404.php HTTP/1.1

HTTP/1.1 200 OK
Date: Mon, 28 Feb 2005 21:04:06 GMT
Server: Apache/2.0.53 (Win32) PHP/5.1.0-dev
X-Powered-By: PHP/5.1.0-dev
Status: 404 Not Found
Content-Length: 0
Keep-Alive: timeout=15, max=96
Connection: Keep-Alive
Content-Type: text/html; charset=ISO-8859-1
 [2005-03-04 16:51 UTC] sniper@php.net
This works:

<?php
header("HTTP/1.0 404 Not Found");
?> 

 [2005-03-04 17:08 UTC] OvdSpek at LIACS dot NL
But this bug report wasn't about that, it was about "Status: 404 Not Found" not working.
If that's not supposed to work, please mention that in the documentation.
 [2005-03-10 12:49 UTC] jorton@php.net
I don't think that's expected to work for anything other than the CGI SAPI, so I think this is a docs bug if anything.  Certainly sapi_header_op doesn't special-case Status:; so this isn't apache2-SAPI-specific.
 [2005-03-15 14:08 UTC] vrana@php.net
This is in the docs:

"header that starts with the string HTTP/
...
In PHP 3, this only works when PHP is compiled as an Apache module. You can achieve the same effect using the Status header."

IMHO it's obvious that 1. "this" means "header that starts with the string HTTP/" and 2. you can achieve the same effect with Status header only in PHP 3.
 [2005-03-15 14:10 UTC] OvdSpek at LIACS dot NL
> 2. you can achieve the same effect with Status header
only in PHP 3.

No, it doesn't mean that. That statement means that the status header method always works, except in PHP 3, where it only works if PHP is ran as module.
 [2005-03-15 14:12 UTC] OvdSpek at LIACS dot NL
> Note: In PHP 3, this only works when PHP is compiled as an Apache module. You can achieve the same effect using the Status header. 

This would be correct:
Note: In PHP 3 you can achieve the same effect using the Status header, but only when PHP is compiled as Apache module.
 [2005-03-15 14:14 UTC] OvdSpek at LIACS dot NL
Opened again (sorry, my mistake).
 [2005-03-31 18:05 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

Note about PHP 3 and Status header removed. PHP 3 is old and the note was confusing.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 01:01:59 2014 UTC