ID:               20943
 Comment by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Open
 Bug Type:         Output Control
 Operating System: WIN2K, Apache 1.3.x/2.0.x
 PHP Version:      4.2.3
 New Comment:

Hi,

I just spent a while investigating a simular problem to this one:-

header("HTTP/1.0 403 Unauthorized");

Was sending a header through to my machine but it was not prompting my
browser to display the correct message (IE & Mozilla)

I also noted that 404's were not working either.

Cutting a long story short I manipulated my headers so they looked
simular to a good 404 & came up with the following which now has the
correct effect on my browser.


        <?PHP  
        header("HTTP/1.0 403 Unauthorized");
        header("Connection: Keepalive");
        header("Content-Encoding: Chunked");
        ?>
        kkk

My environment is:
Redhat Linux 8.0 
Apache 2.0.40
PHP 4.2.2

I suspect this is an interaction problem between PHP 4.2.x and Apache
2.0.x .

This also started occurring on my home Linux machine after I upgraded
to apache 2.0.40 and I fixed it using the same method.

Hope this helps someone
Rob


Previous Comments:
------------------------------------------------------------------------

[2002-12-12 03:49:58] [EMAIL PROTECTED]

Yes, by using this distrib it works. Hovever if I run php-cgi.exe from
command line I get this output:

---------------------------------------
Content-type: text/html
X-Powered-By: PHP/4.4.0-dev

Hello
---------------------------------------

so the HTTP header gets stripped. If I change the header in
header("HTTP/1.1 500 Server Error") I get this:

---------------------------------------
Status: 500
Content-type: text/html
X-Powered-By: PHP/4.4.0-dev

Hello
---------------------------------------

thus the HTTP Header is converted to a "Status:" header line. Fine, but
shouldn't Apache be able to handle "HTTP/1.1 nnn xxx" as well?

Michele

------------------------------------------------------------------------

[2002-12-11 11:55:23] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip

------------------------------------------------------------------------

[2002-12-11 11:48:52] [EMAIL PROTECTED]

Tried writing this script (PHP 4.2.3, Apache 1.3.x/2.0.x, not tried
under IIS):

<?php
header("HTTP/1.1 200 OK\r\n");
?>
Hello

If PHP is configured as a Module it works fine. If PHP is configured as
CGI Apache breaks the output and shows its own "Internal Server Error"
page. Apache was installed as out-of-the box, no special options apart
PHP/CGI configuration directives. Apache error log line is:

[Wed Dec 11 18:41:38 2002] [error] [client 127.0.0.1] malformed header
from script. Bad header=HTTP/1.1 200 OK: php-cgi.exe

Is this a correct behaviour? My config is broken? Is it a bug for
Apache????
Thanks
Michele

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=20943&edit=1

Reply via email to