Log errors, and instead of displaying them, show a 500 Error Page in PHP
<p>I am trying to achieve the following for my site; first of all, this is for production mode only. My goal is to keep all errors hidden from the visitor, but log them and display a 500 Internal Server Error Page.</p>

<p>The part of hiding those errors is easy - the only thing is to turn off display_errors.</p>

<p>Right now, I am using a custom written function as error handler. It basically just sends a 500 Error Page, but neither that seems to work. Here is the function:</p>

<p><code>function error_handler($errno, $errstr)
{
    header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500);
    die();
}</code></p>

<p>Because of this, another error occurs - the errors don't get logged because I use die() at the end of this function.</p>

<p>Any idea how this might work?</p>
