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

From: Date: Fri, 03 Jun 2011 19:47:58 +0000
Subject: Re: php causes HTTP 500, but results in blank page in apache
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-313354@lists.php.net to get a copy of this message
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@gmail.com> 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@gmail.com> 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@gmail.com> 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.

« previous php.general (#313354) next »