Re: causing HTTP error status

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 5, 2006 5:01 am, Nic wrote:
> Hi Rabin
> "Rabin Vincent" <rabin@xxxxxx> writes:
>
>> On 5/5/06, Nic <nferrier@xxxxxxxxxxxxxxxxxxxx> wrote:
>>> But /mydir/some.php doing:
>>>
>>>    header("HTTP/1.1 404 Rubbish!!!")
>>>
>>> _never_ causes the error document to be picked up.
>>
>> That's right. Apache's not going to take action based
>
> mod_perl and mod_python can both do this. As can CGIs. So I'll be
> really surprised if this isn't possible with PHP.
>
>>> It's strange because the docs say this can be done; I can't find an
>>> example that is purported to work outside of the docs though.
>>
>> Where do the docs say this? I can't find it in
>> http://php.net/header.
>
> The url is:
>
>   http://www.php.net/manual/en/function.header.php
>
> The relevant bit is where it says:
>
>    There are two special-case header calls. The first is a header that
>    starts with the string "HTTP/" (case is not significant), which
>    will be used to figure out the HTTP status code to send. For
>    example, if you have configured Apache to use a PHP script to
>    handle requests for missing files (using the ErrorDocument
>    directive), you may want to make sure that your script generates
>    the proper status code.
>
>     <?php
>      header("HTTP/1.0 404 Not Found");
>     ?>

I gotta go with Nic on this...

Either I'm being really obtuse, or it just plain don't work right.

Consider this minimalist example:

http://l-i-e.com/404/test.php
http://l-i-e.com/404/index.htm

The 404 header is being completely ignored, afaict

I tried adding "exit;" right after the header, and my browser just
goes way long time and then times out.

I tried HTTP/1.1 and that made no difference.

I'd suggest checking http://bugs.php.net and filing a bug report if
it's not a known issue...

Unless somebody can point out something wrong in our logic.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux