httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark McCulligh <>
Subject Re: [users@httpd] Error page
Date Wed, 06 Oct 2004 14:28:47 GMT
Robert Andersson wrote:

> wrote:
>> so when i have a php error i would like to redirect to an error page 
> You cannot make Apache do this. Apache have no control over the 
> request anymore after PHP started parsing it, so any solution would be 
> in PHP. However, it is unlikely that it can be done anyway.
> Regards,
> Robert Andersson
You need to write a PHP Error Handler Function and add it to every php 
page.  When an error happens on the page your custom function is 
called.  In this function you can do anything you want. Print a nice 
looking custom error message. Maybe Email the webmaster about the error. 
Or do a redirect to another page.  The problem with the redirect would 
be if the php code that fails it after the header info has been created 
you can't use the "location" function in php to do your redirect.

But if you do create a custom error handler function you will have to 
include this function on php page. You can't tell php to do it for you. 
But with the new php 5 there is some new error handling stuff that may 
work but I have not played with php 5 to much yet.


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message