Occasionally when you arrive at a web page, your browser will display the message: 500 internal server error - it’s a show stopper and it looks mean and nasty.
The good news is that if you are a normal visitor to the website, the problem does not lie with your computer and its software nor with your Internet connection. The bad news is that there is not much you can do beyond trying again later or informing the website owner of the problem - if there is no other contact address, try firstname.lastname@example.org (replace nameof.website with the actual name, e.g. example.co.uk). In your report, include the URL of the page you were trying to view - copy and paste it from the text box at the top of your browser.
What does it mean?
The World Wide Web Consortium defines '500 Internal Server Error' as "The server encountered an unexpected condition which prevented it from fulfilling the request." It’s concise and to the point but what does it mean? How can you debug it and fix it?
If you are a web developer with access to the server, it is very likely that you (or one of your colleagues) have caused the problem.
The 500 error is non-specific. It doesn’t really offer any clues to what caused the error, although it is worth checking the server logs. If it occurs on a clean installation, using default configurations, then the problem lies with the installation and you should ensure that all steps were followed correctly and that versions of associated software (PHP, MySQL etc.) are appropriate for the version of the server that you are installing.
If the server was previously working correctly then you probably have a reasonable idea of what you were doing when the error started to occur, but some things to look at are:
- The .htaccess files - is the syntax correct? make sure there is no whitespace or linefeeds before the first or after the last typed character.
- Check the .conf files. Enclosing paths in double quotes avoids problems with spaces, etc.
- Try commenting-out sections such as non-default directory containers to isolate problems.
- Try commenting-out LoadModule statements.
- Check file ownerships and modes are set correctly.
- Ensure that php files do not have spaces or line returns before the first <?php if it is the first line of the file or after the final ?> if it’s the last line.
- Confirm that cgi scripts run cleanly without errors.
If you are using an IIS server, Microsoft have a support page at http://support.microsoft.com/kb/311766.