Throwing errors from a PHP page is quite the same as emulating Apache's behaviour for ErrorDocument
directives, you simply redirect the user using a query-string that specifies variables that
Apache usually sets as environment variables. This makes it possible to use the same error page
for all kinds of errors. An example:
<?php
function throw_error($message) {
$error_page = "/err/error.php";
ob_end_flush(); // Page rendered, flush the output buffer.
?>
Using the PHP4 feature called output buffering also helps creating generic error reporting
functionality. By not flushing the output buffer until you are sure the whole page has rendered
error-free, you are able to make Header calls anywhere in your code to redirect the user.
I'll leave up to the reader to design and implement his/her own error.php page to suit his/her site.
Don't forget that you can include a form with email submission possibilities for the users to send
you comments.