Re: php causes HTTP 500, but results in blank page in apache

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

 




On Jun 2, 2011, at 7:09 PM, Stephon Chen wrote:

Hello Sean,

1. while I directed connected to these error pages such as 403, 404, and 500.html,
they works correctly, showing correct error page

2. but while I use something like header('HTTP/1.1 500') to trigger apache 500
the content of 500.html does not show, but blank page only.
both header('HTTP/1.1 403') and header('HTTP/1.1 404') shows the correct custom error page.

Thanks a lot
--
stephon

On Fri, Jun 3, 2011 at 07:21, Sean Greenslade <zootboysean@xxxxxxxxx> wrote: So do you get the contents of that page in the response? What happens when you browse to that page manually?

On Jun 1, 2011 2:14 AM, "Stephon Chen" <stephon@xxxxxxxxx> wrote:
> All 403, 404, 500.html are static html pages like:
>
> <div>
> 500 error happens
> </div>
>
> On Wed, Jun 1, 2011 at 14:10, Tamara Temple <tamouse.lists@xxxxxxxxx> wrote:
>
>>
>> On May 31, 2011, at 8:14 AM, Stephon Chen wrote:
>>
>> Hello Sean,
>>>
>>> Here is my apache config for error handling.
>>> 403, 404 works fine, but 500 shows blank page
>>>
>>> Alias /errorpage/ "/usr/local/www/apache22/errorpage/"
>>> <Directory "/usr/local/www/apache22/errorpage/">
>>> AllowOverride None
>>> Options -Indexes FollowSymLinks MultiViews
>>> Order allow,deny
>>> Allow from all
>>> </Directory>
>>> #
>>> ErrorDocument 403 /errorpage/403.html
>>> ErrorDocument 404 /errorpage/404.html
>>> ErrorDocument 500 /errorpage/500.html
>>>
>>
>> What's in 500.html?
>>
>>


Stephen,

This doesn't quite work how you're expecting it to.

If you have a php script that emits a 500 server error header, *you* have to supply the document contents. Thus:

<?php
header('HTTP/1.1 500 Server Error');
include('/path/to/error_docs/500.html');
?>

Will get you what you want.




--
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