In php I would like to serve a customized error message before any further processing.
Here is what I have
if($overloaded==true){
header('HTTP/1.0 503 Service Temporarily Unavailable');
header('Status: 503 Service Temporarily Unavailable');
header('Retry-After: 300');//300 seconds
die();
}
from: How do I make php page return a 503 error (or anything non-200)
About 503 Service Unavailable on w3.org :
Note: The existence of the 503 status code does not imply that a server must use it when becoming overloaded. Some servers may wish to simply refuse the connection.
from: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.4
How should I serve an HTTP request when my server is overloaded?