Search code examples
apacheerror-logging

Internal Error 500 Apache, but nothing in the logs?


I'm getting 500 Internal Server errors when I try to make an HTTP POST to a specific address in my app. I've looked into the server logs in the custom log directory specified in the virtual hosts file, but the error doesn't show up there so debugging this has been a pain in the ass.

How do I cause Apache to log Internal 500 errors into the error log?


Solution

  • Please Note: The original poster was not specifically asking about PHP. All the php centric answers make large assumptions not relevant to the actual question.

    The default error log as opposed to the scripts error logs usually has the (more) specific error. often it will be permissions denied or even an interpreter that can't be found.

    This means the fault almost always lies with your script. e.g you uploaded a perl script but didnt give it execute permissions? or perhaps it was corrupted in a linux environment if you write the script in windows and then upload it to the server without the line endings being converted you will get this error.

    in perl if you forget

    print "content-type: text/html\r\n\r\n";
    

    you will get this error

    There are many reasons for it. so please first check your error log and then provide some more information.

    The default error log is often in /var/log/httpd/error_log or /var/log/apache2/error.log.

    The reason you look at the default error logs (as indicated above) is because errors don't always get posted into the custom error log as defined in the virtual host.

    Assumes linux and not necessarily perl