What is 500 Internal Server Error?
The 500 Internal Server Error, is one of the most common HTTP error code. This error does not give much details, but just denotes that the server could not fulfil your request at the moment.
This is a server-side error, which denotes that its nothing to do with your PC, internet etc, but has to be fixed on the web-server end. Any website that you visit on the internet sends a request to the webserver to process your request. The webserver in return sends back the pages, along with a http status code, which denotes the status of the request. A status code of 200 is received when the request is rightly processed. The end user does not see this status code as the request was successful and the pages have been displayed. However, when the webserver is unable to process the request due to some server-side issue it sends out an error code of 500.
Causes of 500 Internal Server Error?
The error code 500, is a group of error codes with different reason. Hence at a first glace you would not know which exact reason caused the error. The only info user has is that the server encountered an error. The probable causes of these Internal server error are:
- Permission error: The permission of the files and folders are not set correctly.
- Corrupted .htaccess: An unsupported entry in the .htaccess file.
- PHP memory limit: A process exceeds allocated memory
How to fix 500 Internal Server Error?
As an end user accessing a website and getting the internal server error there is not much that you can do to resolve the issues. Since the error is a server-side issue the fix also needs to be done at the server end.
You can try the below, as this could be a temporary issue and the webmaster might have fixed it already.
- Refresh the page
- Clear browser cache
- Check back after few minutes
- Inform the website support team on the issue
If this error is got during a payment checkout process in an online purchase. Be careful in refreshing the page, as it might create duplicate orders and multiple charges. Most websites have this handled, but to be on the safer side be careful and do not refresh.
As a website owner, if you get the 500 Internal server Error, you should be troubleshooting and fixing that immediately. This error will not just scare your end customer, but also lower you in the google SEO ranking. Follow the below steps to do basic troubleshooting for this error:
STEP 1: Check log file to identify the issue:
If you are using cPanel:
1. Login to cPanel account
2. Under ‘METRICS’ select ‘Errors’
3. This log will list the last 300 error messages from your website. Details including date and time of error, the file generating the error and many more details can be got from this error log. From these details you can identify the exact error to fix.
STEP 2: If the 500 error is due to Permission Error
Most of the internal server errors are caused by permission issues for files or folders that are required to process the request. In most cases it could be a file permission on a php or cgi script. All such files should be having the permission 0755 (-rwxr-xr-x) and other files 644 (-rw-r–r–). Any file whose permission is wrongly set can be causing the error. See article to change permission of file.
Example: Directories and folders should be 755. Executable scripts within the cgi-bin folder must be 755. Images, media, and text files like HTML should be 644.
STEP 3: If the 500 error is due to corrupted .htaccess file
If providing the right permission did not solve the issue, then check the .htaccess file. Misconfiguration of the .htaccess file is also a very common reason for the error. The .htaccess file has a structure, which if disturbed, even a small typo or syntax error, can break your site.
To identify if the .htacess is causing the error, you can rename the file to .htacess_old and load the website. If the internal error is no longer present, then it shows that the. htacess was the issue. Always take a backup copy of your .htaccess file before making any changes. So that you can restore the backup file if the newly added one is corrupted. Also commenting the new line can help you identify if that is the cause. If you are unable to identify the broken line, then use online htaccess checker tools to check for any errors in your .htaccess file. Correct them or create a new .htaccess file and the Internal error should be resolved.
STEP 4: If the 500 error is due to PHP memory limit
The memory limit, allocates the memory for each process. If the PHP memory limit has been exhausted by the process, then it will throw an internal error. As a temporary solution, you can try increasing the memory limit. If this brings back the site up, investigate further on the reasons for the PHP memory leak.
This is not an exhaustive list of all causes for the 500 Internal Server error. There are several other lesser common reasons like: Syntax error in CGI/Perl scripts, PHP timeouts, third party plugins/theme issues, Server Issues and a lot more other reason. However, we have discussed few of the most common errors that a site admin can troubleshoot when the 500 error is received.
If you want all your KPI‘s or Business metrics monitored on a single dashboard, join our BETA.