What is error 500 and how to fix it
Miscellaneous / / May 04, 2021
Instructions for users and owners of the resource.
What does error code 500 mean
Error 500 (Internal Server Error) is an internal server problem. It occurs when a browser or another client sends a request to the server, and the server cannot process it.
One of the most common causes of a 500 error is incorrect syntax in the .htaccess file. In addition, it sometimes occurs after uploading incorrect CGI scripts to the server or installing incorrect access rights.
That is, in error 500, as in other answers with a code that begins with the number 5, the developers or server administrators are to blame. But not users.
What to do for a user with a 500 error
If you see a 500 error on someone else's site, you have two options.
Wait
If you do not have access to this resource, you will not be able to edit the file, change settings, or perform other similar actions. So it's worth waiting until administrator will fix the error and visit the site later.
Inform the resource administrator
Not all site owners monitor logs and read error messages around the clock. It is possible that the administrator is simply not aware that the site has stopped working.
If so, you can help. Try to find contact information and contact the owner of the property to report a problem. If you do not see any useful data on the site itself due to error 500, find the saved copy of the page in search engines or in internet archive.
What is meaningless for a user to do with an error of 500
Since the problem is with the server, there is no reason for the client to do anything. So don't try:
- restart the computer;
- change browser;
- reinstall software;
- reboot router.
What to do for an administrator with a 500 error
Of course, a lot depends on the specifics of your resource: what engine it runs on, what hosting it is located on, and what have you changed on the site recently. Still, universal recommendations in most cases help get rid of the 500 error.
We advise you to consistently try each of the options, if, of course, it is relevant for your resource.
Check syntax of .htaccess file
If you are using the Apache web server, then there is most likely a .htaccess file in the root of your site or in subfolders. It stores server settings.
In most cases, the resource will work without this file. Try renaming .htaccess, for example, to .htaccess_, and then go back to the main page of the site.
If the 500 error has disappeared, then the problem is in .htaccess. Check the syntax of this file - you may have inserted an extra character somewhere or made a typo while editing. If there is a previous version of the settings, check it in and see if the 500 error appears.
Sometimes it helps to comment out the Options line in .htaccess - insert # at the very beginning of it. If that doesn't work, comment out the other lines as well, and then remove the # sequentially to find the problematic location in the file.
If you've edited .htaccess, check to see if the changes are saved. It happens that the hoster sets permissions on this file that prohibit editing. In this case, try downloading .htaccess to your computer, change the file in any text editor and upload to the site instead of the old version.
View error log
If you've recently done some work on the site, it may have resulted in a 500 error. Open the logs and see if there are any problem messages. If so, analyze them and try undo recent adjustments.
Hosters usually indicate where the logs are stored by default and how to access them from the control panel. This information can be found in the help or FAQ (frequently asked questions) sections on the hosting site.
Set permissions for CGI scripts
If you use CGI ‑ scripts, then the files with them and the folders in which they are located must have access right 0755 (drwxr ‑ xr ‑ x). This combination only allows the owner to write to them. Other users can only read these files and run them.
If you have different permissions set, this may result in a 500 error.
Check content of CGI scripts
Valid CGI scripts must have line endings in Unix format (\ n), not Windows format (\ r \ n). To keep the correct version, you need to upload the code to most hosting sites via FTP in ASCII mode. If you don't know what settings you used, reload the scripts and see if the 500 error is gone.
Also, CGI programs can generate incorrect HTTP response headers. In this case, you will most likely see errors in the logs.
Remove or disable recently installed plugins or components
It happens that individual components of a site or plugins conflict with each other. This also leads to error 500 and other server side issues.
If you've recently installed or updated modules, try disabling these items in the admin panel. Perhaps, after that, the site will have other errors. But if the 500 answer no longer comes, it is just a component or plugin conflict.
Optimize scripts
If the scripts take a long time to execute or there are not enough resources for them, try revising their contents. Perhaps the code needs to be optimized so that it consumes less CPU time and RAM.
Especially often scripts lack resources if you use virtual hosting. There, the amount of memory is strictly limited so that all accounts within the same physical server have equal opportunities.
Try to break the script into blocks and evaluate the performance of each of them. If there are a lot of external calls in the code or the memory consumption is steadily growing up to the set limit, it is definitely worth doing something about it.
Increase the server's RAM
It happens that even after the scripts are optimized, they still consume too much memory. In this case, you will have to switch to a more expensive hosting package or, if such an opportunity is provided, increase the memory allocation directly. And do not overpay for other resources that you don't need.
Ask for help
Contact the hoster's support service or the profile forum. Look for similar errors on Stack Overflow - if there is no suitable theme, create a new one. Describe the situation in as much detail as possible and be prepared to try the different options that will be offered to you in the comments.
True, sometimes you have to wait a long time for answers. Therefore, it makes sense to go to similar topics and ask for help there.
Finally, you can register on sites for freelancers as a customer. Experts will help you solve the problem, even if not for free.
Read also💿⚙️💻
- What to do if the browser slows down
- How to fix CPU Fan Error when booting your computer
- What to do if the DNS server is not responding
- What does 404 Not Found and other web page errors mean?
- What to do if the Internet is lost on Windows
"Hard and painful": what the first viewers of the fourth season of "The Handmaid's Tale" write
May 17 Major TV Shows: New Star Wars, Love, Death, and Robots and The Food Block