Whether you are a techie or a regular Internet user, it is very likely that you have come across the frustrating 500 Internal Server Error. This article explains what it is exactly. It discusses what causes the error, and what may be done to fix it.
Since this is a server error, in a large majority of cases, the 500 Internal Server Error is NOT your fault. While that may seem like good news, the bad news is, in those same cases, there’s probably nothing you can do to fix the problem. However, some options have been listed below that may help you fix the 500 error on websites that you don’t own.
If you’re the owner of the website experiencing this problem (or the system administrator), you should certainly be able to do something about it. Read the details of options available to you below.
If you are not a techie, it may be helpful to state that when a client (your computer or smartphone) makes a request to a web server, status codes are issued to explain to the client how the request was handled and if there was any error encountered while handling the request.
There are five categories of status codes ranging from 1 to 5, with the first digit of the code defining the category of the response.
In this article, we will focus on one of the errors in the fifth category of HTTP status codes, the 500 code, otherwise known as the 500 Internal Server Error or in tech circles, simply as Error 500.
If you’re curious about the other status codes, check out the official IETF list of HTTP Status Codes.
What Is The 500 Internal Server Error?
When a server returns an error code beginning with the number 5, it is an indication that the server is aware that there is an error, or for some reason, is incapable of handling the request.
The 500 Internal Server Error is a generic message indicating that something is not right on the server, and the server does not know (or has been configured to not tell the user) exactly what the problem is. So, in most cases, this error is usually pretty vague.
How The 500 Error Is Commonly Displayed
The screenshot below is probably the most common representation of error 500:
If the website runs on the highly popular Apache web server, depending on the specific error and the server configuration, the error message may appear also as shown in this screenshot:
Notice that there is no definite statement of what the error is. It’s just like when someone says they don’t feel well but doesn’t say (or know) exactly what the problem is – they just know they’re not fine.
Since different web servers allow system administrators to customize messages associated with HTTP status code errors, the 500 Internal Server Error message may be displayed in many ways. These are some of the more popular renderings:
500 Internal Server Error HTTP 500 - Internal Server Error Temporary Error (500) Internal Server Error HTTP 500 Internal Error 500 Error HTTP Error 500 500. That's an error
How The 500 Error Is Displayed On IIS Websites
If your website sits atop Microsoft’s IIS web server, the error messages will be a little more granular (in the 5xx.x format).
IIS 7.0 and later versions define the following HTTP status codes that indicate a more specific cause of a 500 error:
|500.0||Module or ISAPI error occurred.|
|500.11||Application is shutting down on the web server.|
|500.12||Application is busy restarting on the web server.|
|500.13||Web server is too busy.|
|500.15||Direct requests for Global.asax are not allowed.|
|500.19||Configuration data is invalid.|
|500.21||Module not recognized.|
|500.22||An ASP.NET httpModules configuration does not apply in Managed Pipeline mode.|
|500.23||An ASP.NET httpHandlers configuration does not apply in Managed Pipeline mode.|
|500.24||An ASP.NET impersonation configuration does not apply in Managed Pipeline mode.|
|500.50||A rewrite error occurred during RQ_BEGIN_REQUEST notification handling. A configuration or inbound rule execution error occurred.|
Note Here is where the distributed rules configuration is read for both inbound and outbound rules.
|500.51||A rewrite error occurred during GL_PRE_BEGIN_REQUEST notification handling. A global configuration or global rule execution error occurred.|
Note Here is where the global rules configuration is read.
|500.52||A rewrite error occurred during RQ_SEND_RESPONSE notification handling. An outbound rule execution occurred.|
|500.53||A rewrite error occurred during RQ_RELEASE_REQUEST_STATE notification handling. An outbound rule execution error occurred. The rule is configured to be executed before the output user cache gets updated.|
|500.100||Internal ASP error.|
What Causes The 500 Internal Server Error?
Well, first of all, if you are not the webmaster or site’s developer, it is very unlikely that you are the cause of the error. Like the error name indicates, this is a server error. It could be the result of a misconfiguration on the server, making it unable to properly handle requests. It could also be the result of a programming error in a script running on the server.
Suppose the developer made a mistake when programming the site. Let’s say they didn’t end a statement with a semi-colon, or they made some other common programming error. Because the server cannot parse the code in the script properly, it may just serve you with the 500 error code.
In cases of programming bugs like this, the server may not know exactly what the problem is. And even if the server knows, it is not a good idea to let website users know the details of such bugs. So, error 500 acts as the standard “catch all”.
Sometimes too, the user and the developer may share the blame. A friend may have sent you a link via email or via an instant messaging app. You may have copied the link and pasted, but inadvertently left out a character or two, or even a significant part of the link. That’s your part of the blame.
The developer may not have properly programmed the site to handle such user-generated errors, forcing the server to return the 500 Internal Server Error. That’s their part of the blame.
Other common causes of the error include:
- Permission errors
- Script timeouts
- .htaccess coding errors
- …and so on
What Can You Do About It?
Well, start from the known to the unknown. The first 3 fixes below are really simple things you can try. But they are not very likely to change anything. The chance of solving a 500 error using any of the first 3 options below is relatively slim. But these are really easy first things to try. And as always, “there is no harm in trying”.
Fix #1: Reload/Refresh The Page
As you may have noticed in the most common representation of error 500 (screenshot above), there is a reload button. So, hit the reload button, or press F5, or depending on your keyboard, Shift + F5.
Even though error 500 is a server error, it may just be a temporary one and by the time you have reloaded the page, the problem may have gone away.
Please Note: If you hit error 500 during the checkout process while shopping online, reloading the page may end up creating multiple orders and charging you multiple times. While merchants and developers usually build automatic protections from such situations, you should certainly keep the risk in mind.
Fix #2: Clear Your Cache
Clear your browser cookies and cache. Sometimes, there may be a kind of conflict between the web server and the cookies stored on your computer. Or, you may be viewing a locally cached file from a previous attempt at viewing the site. If any of these happens to be the problem, then clearing your cache would solve it.
Fix #3: Troubleshoot A 504 Error Instead
Restart your router and make sure you’re not experiencing any Internet issues.
In rare cases, the 500 error may in reality, be a 504 Gateway Timeout error. The web server may just be sending the wrong error code. So, troubleshooting a 504 error, might help. And a quick way to do this is to restart your modem or router and make sure you are not having any Internet speed issues.
Fix #4: Contact The Webmaster Or Site Owner
It is unlikely that out of the over 1.8 billion websites on the Internet, the one you’re trying to access is the only one that has what you’re looking for. Unless perhaps you’re trying to buy a unique product from an online shop. Or maybe the topic you’re reading about belongs to a very small niche with few known experts. If that happens to be the case, and you know the site’s webmaster, reach out to him.
If it’s a popular website, you may take to social media, searching for hashtags about the problem of the site. Such hashtags like “facebookdown” or “googledown” may yield more information about the problem if it has gone wild.
Fixing 500 Internal Server Error On Your Own Website
One of the first things you may want to do is to read your server logs. Very often, error logs will reveal exactly what the problem is.
The locations of your error logs will depend on the web server you’re working with. For the popular Apache web server, some logs you might want to check include error_log, access_log, and suexec_log. Personally, the first log I check is error_log as it almost always tells me exactly where the problem is coming from – down to the exact line of problematic code!
If you’re on Apache and the error is caused by a permission, you could temporarily change the permissions of the file you are trying to access to 0755, so that it can be read, written to, and executed. If this makes the error go away, play with your permission values until you get a number you’re comfortable with that works without error and yet doesn’t expose sensitive data to the world.
In the case of the error being caused by a script timeout, it may be that your script connects to external APIs or other resources that may not be responding fast enough or have other issues. Or it could also be that your code has some syntax or logic errors. Perhaps even an infinite loop.
In such cases, you know what you coded and you know the APIs you’re connecting to. Analyze your work carefully and make sure your code is working fine. That should provide a fix.
You may also want to consider increasing the value of script execution time across your web server or on any specific virtual host.
In some cases too, the problem may be caused by a messed-up .htaccess file. For some web developers, understanding .htaccess code seems like voodoo, and coding one up by themselves is like trying to understand what color the number “A” smells like.
If you think your .htaccess file is the culprit, get it right or get someone to help you with it. Also check out my article on Working With The .htaccess File for some quick pointers.
If you are working with a popular CMS like WordPress, Joomla or Drupal, there is massive documentation on their official websites, and there are forums where related topics are being discussed. Usually, a quick Google search would give you what you need to fix the problem.
If you still can’t figure out what the exact cause of the problem is, you may wish to contact your hosting provider after reading any articles they might have about this error in their blogs.
I’m also quite willing to help server admins troubleshoot problems. So, you can reach out to me via the comments section below with details of your problem.