Wednesday, April 6, 2011

How to diganose an unlogged Error 500 on Apache?

We are running a very simple Symfony script, that randomly returns an Error 500. The system administrator says he can't find any trace of an Error 500 on the error logs, however using Curl or Firebug, it is obvious that an Error 500 is being returned.

The script simply parses a POST request submitted to an URL on our server. We already checked for performance, memory etc but nothing seems to be the problem.

How is this possible? We already enabled all debugging, logging, on Apache, PHP, etc and nothing.

From stackoverflow
  • The following testscript also won't generate any error messages/logs.

    <?php
    header($_SERVER['SERVER_PROTOCOL'].' 500 Internal server error');
    echo 'Something went gaga';
    ?>
    

    However the access_log will show the "500" response code (assuming apache's default access_log settings)

    Search the code for "HTTP/1.1 500", "500" or "header(" and add:

    trigger_error('Peep', E_USER_NOTICE);  // or error_log()
    

    This will generate an entry in the errorlog (with filename and line-numbers)

0 comments:

Post a Comment