Last modified: March 11, 2020
What is a 500 Internal Server Error?
For every request that is sent to a server, there is an http status code that is returned. These status codes will be returned as a 3 digit number (200, 403, 404, 500, 502, etc). Each of these numbers provide some indication as to what type of issue is preventing your site from loading. The 5XX errors indicate that a request has been sent to the server, but some technical issue has prevented this request from being completed.
The 500 Internal Server Error in particular is a catch-all error message, given when no more specific message is suitable. There can be a number of causes for a 500 Internal Server Error to display in a web browser. Below is a sample of what a 500 error message will look like.
Below are common troubleshooting steps that can be taken to resolve a 500 Internal Server Error:
Check the Error Logs!
With any error message, particularly one as broad as the 500 Internal Server Error, you will first want to check any Apache and PHP error logs for your server. These logs can provide valuable context related to any code failures or other potential causes of a site failure. For information on where to find the logs for your server, please see: Where are the access_log and error_log for my server?
Error with an .htaccess file
If you are using a .htaccess on your site, it may be interfering with the web page you are trying to load into your browser. Please double check the .htaccess configuration. Any syntax errors will cause a 500 Internal Server Error message to be displayed instead of your website.
To confirm whether a misconfiguration .htaccess is the cause of the 500 Internal Server error, either remove or rename the .htaccess file temporarily and then try to reload the page.
PHP Coding Timing Out
If your PHP script makes external network connections, the connections may time out. If too many connections are attempted and time out, this will cause a "500 Internal Server Error." To prevent these time outs and errors, you'll want to make sure that PHP scripts be coded with some timeout rules. Typically, however, catching a timeout error when connecting to a database or externally to remote resources (example: RSS feeds) are difficult. They, in effect, freeze the script from continuing to run.
Removing any external connections can increase both the performance of your website and decrease the chances of you receiving a "500 Internal Server Error."
Syntax or coding errors in your CGI/Perl script
If it is a web page ending in .cgi or .pl that is producing the error, check your script for errors. For detailed troubleshooting tips, please see: Troubleshooting CGI/PERL scripts.
CGI Script Guidelines
- When editing your CGI script, use a plain text editor - a program that saves the file as a 'text file' type. DO NOT use Wordpad that comes with Microsoft Windows because it doesn't save files in pure ASCII text format. Use Notepad instead to edit files.
- Upload your CGI scripts in ASCII mode into the cgi-bin directory.
- Set the file permissions on the CGI script file and directories to be chmod 755. If you use an FTP program to transfer files, right-click on the file and select change file attributes. See Using FTP and SFTP for more information.
- Double-check that the Perl modules you require for your script is supported. For a list of the currently supported Perl modules, please click here.
Need further assistance with your server? Help is available via Advanced Support, our premium services division. For more information on what Advanced Support can do for you, feel free to click here.