To fix a 5xxx error, you need to solve the problem causing it on the server. This may require code debugging, configuration updates, or installation of new system components. We've put together recommendations for people facing HTTP 500 error that doesn't report a specific problem.
What is error 500?
The HTTP 500 response code doesn't indicate the actual problem, it just notifies you that something went wrong on the server.
Internal Server Error, or 500 server error means that the server is unable to process the request. One of the downsides of 500 is its effect on a site's place in the search engine results. Spiders stumbling across error 500 multiple times will lower your ranking and thus affect the number of traffic and potential profits.
The task of fixing the Internal Server Errors can be eased considerably by Microsoft Internet Information Services. This service specifies an error code in the form 500.xx, where the last two numbers indicate the detailed cause:
500.13: The web server is overloaded.
500.19: Configuration data is invalid.
Causes of Internal Server Error
As the code 500 is a common problem identification, you can look for the cause of the error almost everywhere. Most often 500 server error means:
- Incorrect permissions to files and folders of the site.
- Wrong operation of scripts.
- Bugs in the CMS, incompatible plugins, and themes.
- Server overload with incoming traffic.
- Exceeded PHP memory limit or outdated PHP version.
- No connection to the database, wrong login credentials, etc.
- Outdated data stored in the cache.
- Incorrect address (URL).
While trying to fix the problem, remember that the 500 internal server error causes is almost always related to the server, not the client side.
The guide how to fix a 500 error for users
Here are some recommendations if you, as a user, face an HTTP website 500 error.
- Wait and reload the page. The problem has possibly already been mentioned by the web administrator, and all you have to do is just wait for the error 500 to be fixed.
- Double-check the URL. The server may be unable to process the request if it doesn't find the needed parameter. Double-check the URL and try loading it again.
- Clear your cache and browser history, then visit the website again.
Check the site at downforeveryoneorjustme.com. This service will tell you if the site is down for everyone or if the problem is on your side by checking the HTTP status code from the server.
How to fix a 500 internal server error if you are the site ownerHere are some tips on how to fix http 500 internal server error:
- Setting permissions and checking the .htaccess file.
Check the permissions of files and folders on the site. Using permissions 644 for files and 755 for folders is usually recommended. To set permissions, use an FTP client or the server console. Default permissions are set as 777 - permissions for all, including reading, editing, and other operations.
Check the .htaccess file. Error 500 may also be due to a misconfigured .htaccess file. Ensure that the .htaccess file syntax is correct and that there are no errors in it. If necessary, delete the .htaccess file and upload it again.
Check the server logs. Often the cause of internal server errors is described in the server logs (we described this method in the 5th step).
Contact your hosting provider. The hosting provider's technical support can help you sort out the problem and provide more information about the error.
- Scripts are working with mistakes.
Debug the script and view the server logs. Server logs usually contain information about errors that occurred in the script. Then fix the errors or syntax mistakes in the script. After fixing the script, you need to restart the server for the changes to take effect.
- Bugs in the CMS.
Check plugins and extensions. A conflict between several plugins and extensions can lead to Internal Server Error. Deactivate all plugins and, if the error disappears, turn them on one by one to find the problematic one.
Update your PHP version. If it takes more than five minutes to process a PHP request, it will automatically terminate and generate an HTTP 500 error. A possible problem could be an outdated version of PHP.
Update the CMS and other programs. HTTP 500 error can occur if the web application uses an outdated CMS version that is no longer compatible with the current software version or browser. When updating the CMS, you need to consider compatibility with other components of the system (e.g. database or extensions).
- Check the URL.
If a web application expects to get a certain parameter in a URL that is not there, this can cause a 500 error. In this case, you need to configure the server to handle any similar requests.
You can also check the desired URL at downforeveryoneorjustme.com. Here you will find out whether access to the page or site is limited only to you or to all users.
- Checking logs and cache.
To check the server logs, you need to log into the server via some utility that is convenient for you (for instance, with ssh). Logs are usually located in the /var/log or /var/log/httpd folder.
To view the log file, use the cat or tail command. To view all the contents of the error.log file, use the command:
To display the last 10 lines of the error.log file, use the command:
tail -n 10 /var/log/error.log
You may need to reload the website to reproduce the HTTP 500 error code and see how the log file is generated. This will allow you to recognize the real cause of the error.
- Check the connection to the database. What you should pay attention to:
Server and database logs. Check logs to identify the problem.
Database configuration. Check the correctness of connection and server settings.
State of the DB server. The server should not be overloaded and should have enough resources to process requests.
The scripts. Make sure that scripts work correctly and don't contain syntax errors.
Database permissions. The user (administrator) must have the necessary permissions to work with the database.
Network connection to the DB server. Check the stability of the connection.
Try restarting the database server. This may help solve some temporary problems with the database.
Other 5xx errors and their causes
Errors of the 5xx type are most often related to problems on the server side and cannot be solved by the client.
The most common 5xx errors:
- 501 Not implemented. This error reports insufficient functionality to process the request.
- 502 Bad Gateway. This usually means that the server, which acts as a gateway or proxy server, cannot access the desired resource.
- 503 Service Unavailable. 503 most often indicates that the server is temporarily unable due to overload or technical servicing.
- 504 Gateway timeout. The server hasn't received a response from the upstream server, to which it has addressed, in the designated period of time.
- 505 HTTP version not supported. The server doesn’t support the HTTP version that is specified in the user's request.
- 507 Insufficient storage. Here everything is elementary - the server cannot store the representation needed to successfully complete the request.
- 510 Not extended. The client's request contains an extension that is not supported by the server. As a result - inability to process the request
The causes of 5xx errors can be different. They can occur due to server overload, incorrectly running code on the server, unavailable database, incorrect server configuration or other services. The main problem with 5xx errors is not only the loss of traffic and customers, but also a lowering of rankings by search engines.