# Fw: [PHP-DOC] #27345 [Opn]: Status header with PHP CGI

- Thread: https://externals.io/message/8217
- Original archive: https://news-web.php.net/php.internals/8217
- Started by Nuno Lopes on 2004-02-27T13:58:54+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #8217 — Nuno Lopes — 2004-02-27T13:58:54+00:00

URL: https://externals.io/message/8217#8217

Can anybody clarify this, please?
Nuno


----- Original Message ----- 

> ID:          27345
>  Updated by:  nlopess@php.net
>  Reported By: php_bugs at ecora dot de
>  Status:      Open
>  Bug Type:    Documentation problem
>  PHP Version: Irrelevant
>  New Comment:
> 
> I couldn't reproduce this in PHP 5.
> 
> header("HTTP/1.0 404 Not Found"); print "Status: 404"
> 
> and
> 
> header("Status: 404 Not Found"); prints "Status: 404 Not Found"
> 
> 
> Can anybody check this in PHP 4?
> 
> 
> Previous Comments:
> ------------------------------------------------------------------------
> 
> [2004-02-22 05:10:36] php_bugs at ecora dot de
> 
> Description:
> ------------
> Hi,
> 
> <Documentation>
> header("HTTP/1.0 404 Not Found");
> [...]
> 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. 
> header("Status: 404 Not Found");
> </Documentation>
> 
> IMHO this is not correct. Because the HTTP-status-header (also
> Content-Type- and Location-Header) is always a server parsed header,
> when PHP (PHP3, PHP4, PHP5 or also Perl or Python, ...) runs via CGI. 
> 
> The official CGI Specification (see http://www.w3.org/CGI/):
> http://hoohoo.ncsa.uiuc.edu/cgi/out.html
> 
> That means not only in PHP3 also in PHP4 or PHP5: When PHP runs via
> CGI, then you have to write:
> header("Status: 404 Not Found"); instead of header("HTTP/1.0 404 Not
> Found");
> 
> 
> 
> 
> Reproduce code:
> ---------------
> When i try to send a header("HTTP/1.0 404 Not Found"); on my
> installation (Apache 1.3.29 + PHP 4.2.3 CGI on Linux) then i receive a
> 500 internal server error
> 
> 
> 
> ------------------------------------------------------------------------
> 
> 
> -- 
> Edit this bug report at http://bugs.php.net/?id=27345&edit=1

---

## #8225 — Rasmus Lerdorf — 2004-02-27T15:07:58+00:00

URL: https://externals.io/message/8217#8225 · In reply to: #8217

Unless of course there is code in there to look for HTTP/ and set the
appropriate status code.  This code used to be there, but it may have
gotten dropped along the way.

-Rasmus



> Can anybody clarify this, please?
> Nuno
>
>
> ----- Original Message -----
>
> > […]

---

## #8237 — Nuno Lopes — 2004-02-27T15:56:07+00:00

URL: https://externals.io/message/8217#8237 · In reply to: #8225

So, what shall I do?
Mark this bug as bogus or update the documentation.  If yes, what should I
add/remove/modify?

Nuno

----- Original Message ----- 
> Unless of course there is code in there to look for HTTP/ and set the
> appropriate status code.  This code used to be there, but it may have
> gotten dropped along the way.
>
> -Rasmus
>
> 
>
> > […]
> ------------------------------------------------------------------------
> > […]
> ------------------------------------------------------------------------
> > […]

---

## #8238 — Stefan Walk — 2004-02-27T17:46:55+00:00

URL: https://externals.io/message/8217#8238 · In reply to: #8237

> So, what shall I do?
> Mark this bug as bogus or update the documentation.  If yes, what should I
> add/remove/modify?
> 
> Nuno

There's no problem with the documentation, the behaviour is wrong. 
when doing header('HTTP/1.1 404 Not Found'); in CGI, just
'Status: 404' is outputted where it should output 
'Status: 404 Not Found'

-- 
Regards,
Stefan Walk
<swalk@prp.physik.tu-darmstadt.de
