People who develop web apps, websites often get to see the HTTP Error 500 or the Internal Server Error. And the thing is that fixing this issue can be a really hard task. Because the error does not appear because of a specific reason.
But there can be quite a lot of reasons why you are getting the Internal Server Error. So the question is how to fix HTTP Error 500? Well, in this article, I am going to talk about this only. So you can easily get rid of this internal server error.
Anyway, let’s just head into the topic without wasting much of the time:
What is HTTP Error 500 or Internal Server Error?
The HTTP Error 500 can appear because of multiple reasons. However, all of them mean the same thing. While accessing a web app or a website, you might get to see errors like “500 Internal Server Error”, “500 Error”, “HTTP Error 500”, “500. That’s an error”, “Temporary Error (500)”, or just the error code “500”. And all of these errors are the same ones.
However, whenever you get to see such a message on your computer, this simply means that there is something unexpected happened on the webserver and the server cannot offer you any specific information. As a result, instead of giving you a normal web page, it returns with an error.
How the 500 Internal Server error appears?
Now the question is how the 500 Internal Server error appears? Well, the internal server error message can be customized by each website that you visit.
This means that the error might appear in different forms when you experience it. However, to make you understand in a better way, here are the common messages that you get to see:
- Internal Server Error
- HTTP 500 Internal Error
- 500 Internal Server Error
- HTTP Error 500
- HTTP 500 – Internal Server Error
- 500 Error
Also, if you are using Internet Explorer and getting the “The website cannot display the page” message. This also means that you are getting the HTTP Error 500 error. And the best way to spot the error is to look at the 500 in your IE toolbar.
What causes a 500 Internal Server error?
Now the question is, what causes a 500 Internal Server error? Well, the error simply indicates that there is a problem on the server-side.
A server error can be caused because of a number of things. Maybe there is an incorrect upload in the server. Or there is a bug in the code structure.
And as the web browser cannot solve or get rid of the bug, hence it is simply telling you that there is something wrong. But your website is not sure what exactly went wrong.
If you root access, then you can go ahead review your web server’s error logs to get more information about this.
And in case if you are using a shared hosting plan, then you can also contact your hosting provider to get more information. Also, as it is a server-side error, this means it has to do something with the website programming or configuration setting.
If the server is using Microsoft IIS software and not Apache. Then there is a high chance that you will find some clues to figure out what is causing the Internal Server Error.
Along with this, you should also focus on multiple debugging options and try to fix the issues. However, in case if you are not sure how to fix the Internal Server Error, then let me just go ahead and talk about the fixes that you can try out.
So here we go:
HTTP Error 500 – Internal Server Error and How to Fix This
Well, before you go ahead and start working with any of the methods to fix the HTTP Error 500, I would advise you to take a backup of your website.
So in case if there is something wrong happens with your website, and the situation gets bad to worse. You will be able to use the backup to make things as it is now.
And there are quite a lot of ways to backup your website depending on what type of web hosting you are using. However, to help you out, let me just go ahead and share a quick guide on how to take a backup of your website on Shared Hosting.
How to take a site backup on shared hosting?
- First of all, you have to log in to your hosting’s Cpanel.
- After that, you will need to look for the Backup option and click on it.
- Next, you will need to click on the Download a Full Website Backup option.
- From the next screen, you will need to select the Home Directory option from the Backup Destination’s drop-down menu.
- Also, in case if you want to get email notification when the backup gets completed. Simply enter your email address. And in case if you do not want to get an email notification, then place a tick on the “Do not send an email notification of backup completion” option.
- After that, click on the Generate Backup button, and it will start creating a full backup.
- Once the file generating process gets completed, you will get an email notification if you have enabled it.
- Then simply go to the /home directory of your Cpanel, and over here, you will find your backup. Simply download it on your computer for future use.
- Also, to restore the backup go to Cpanel then Backup wizard. After that, select restore and upload your file, and you are all done.
Now that you are done downloading a backup of your website, so let’s just go ahead and talk about the steps that we have to follow to fix the Internal Server Error.
Debugging the Issue
One of the first steps that you can start with is debugging the issue. By doing so, you will be able to get the sense of the error.
And for this, you will need to check PHP logs or part of apache error logs. So you can get more information about the error.
And in case if you are unable to find the error logs there, then you should try enabling PHP error reporting by making some changes into the index.php file.
So go ahead and open up the index.php file and then you will need to paste these lines of code in there:
Also, in case if you have a WordPress website, then you will need to download the wp-config.php file, which is located into the Website’s root directory. You can download the file from Cpanel or using an FTP client.
Once you are done downloading the file, simply open it up using your preferred text editors. If you do not have a text editor installed on your computer. Then you can try out Notepad++ for Windows and TextMate for macOS.
Next, once you are done opening the file, you will need to search for the ‘WP_DEBUG’ string. Once you find the line, you will need to change it from False to True and upload the file back to the server.
In case if you do not find the line in the config file, then you will need to add these following lines into the wp-config.php file:
define( “WP_DEBUG”, true );
After that, reload the website and see if the error changes or not. And in case if it does, you might get to see a “Fatal error” message that points to a specific line of code in a specific file. And this is a simple code error.
Over here, I am going to assume that the error is coming from a plugin or theme. Then you will need to disable the plugin or theme and then check if it has fixed the issue for you or not. And in case if you are not sure how to disable plugins and themes from the Cpanel, then you will need to follow these step.
How to disable plugins and themes from Cpanel?
Step 1: First of all, login to your Cpanel.
Step 2: Then click on the file manager to access your website files.
Step 3: Next, you will navigate to your WordPress installation folder and open up the wp-content folder.
Step 5: Then go to the plugins folder.
Step 6: Over here, look for the plugin that you would like to disable. Then simply right-click on it and rename the file.
Also, you will need to follow these steps to disable the theme if there is an issue with the theme on your website.
Plus, keep the fact in mind that once you are done finding the problem. Make sure to change the WP_DEBUG value from True to False and upload the file again to the server.
Troubleshooting Popular Software Problems
The next thing that we can try out is troubleshooting popular software problems. If your server is running some of the popular applications like WordPress, then bad installations, incompatible versions, and incorrect server permissions can cause an HTTP 500 Internal Server Error.
However, the good part is that fixing the issue is not as hard as it seems. And here are a couple of things that you can try out fix the issue:
- First of all, you should start by checking if you have recently installed or upgraded any software, and it actually failed to install or upgrade properly. In such a case, you should disable the software and check if everything is working fine or not. If not, you should contact the software vendor for further help.
- There is also a high chance that any newly activated plugin or theme is conflicting with your website, and as a result, you are getting the internal server error. Now you will have to deactivate the themes and plugin one by one and see if it is working for you or not. ( To disable them, you can check out the above How to disable plugins and themes from Cpanel guide).
- If you just upgraded your software, your current plugins, or themes, then there is a chance that it is not compatible with the new upgrade. In such a case, you will need to deactivate plugins or themes one at a time. And check if it is helping you to solve the issue or not.
Debugging Server-Side Scripts
You can also try out debugging server-side scripts. Custom scripts that are currently getting developed and test can also cause the HTTP 500 Internal Server Error.
However, to fix this issue, you can go ahead and follow these steps:
- Wrong permissions on a file or folder that has a script like a PHP or GGI script. Then it will not allow the script to run because of the permissions. So first of all, you should go ahead and check your permissions and make sure you set them correctly on your server.
- There is also a pretty good chance that the programming errors or unavailable resources are causing the issue. As it will not allow the script to run and create an endless loop, and you will get the timeout error.
- Even coding errors of a .htaccess file and custom scripts can also cause the HTTP 500 Internal Server Error.
Errors with the .Htaccess File
As mentioned above, there could be an error with the .htaccess file. If you are using a .htaccess file on your website, then there is a high chance that it might be interfering with the webpage that you are trying to access in your browser.
So in such a case, I would recommend you to go ahead and check the .htaccess configuration. Any syntax errors will cause a 500 internal server error.
Also, to confirm whether a misconfiguration of .htaccess is the main problem behind the HTTP error 500, I would recommend you to remove the .htaccess file (of course, make sure to have a backup at first). Or you can simply rename it for a temporary time and see if it has helped you to fix the issue or not.
PHP Coding Timing Out
If your PHP scripts are designed to make an external network connection, then there is a chance that the connections are getting timed out.
If there are too many connections are getting attempted and all of them are returning with the time out, then it will cause you the internal server error.
Now to prevent this what you can simply do is make sure that PHP scripts are coded with some timeout rules.
However, the thing is that catching a timeout error when connecting to a database or externally to remote resources (example: RSS feeds) are difficult. What exactly happens in a server is that, the scripts get frozen from continuing to run.
So by removing any external connection can help you to increase both the performance of your website. As well as it will help you to reduce down the HTTP Error 500.
Creating a New .htaccess File
We can also try creating a new .htaccess file. As there is a high chance that the current .htaccess file on your website might be corrupted.
So in such cases, you will need to login to the WordPress root directory through the Cpanel, or you can use an FTP client like FileZilla.
After that, you will need to enter into the public_html folder. And over here, you will find folders like wp-admin and wp-content, and if you do, then it means you are at the right place.
Now over here, you will have to look for the .htaccess file. In case if you do not get to see such file then make sure that the hidden files are viewable by clicking Server and selecting Force Showing Hidden Files.
Once you have found the .htaccess file, simply right-click on it and rename the file to “.htaccess.bak”. By doing so, the current .htaccess file will no longer be in use.
And now we will need to create a new .htaccess file. So for this, simply go to your WordPress admin area. Hover over to Settings, and select Permalinks. Scroll down to the bottom of the page and click Save Changes.
Next, open your website in your browser, and you should see if everything is working fine or not. And if this happens, it simply means the error was caused because of a corrupted .htaccess file, and your issue is now fixed.
Increasing Your PHP Memory Limit in WordPress
PHP memory limits are set by your host and WordPress. WordPress will attempt to increase your limit if you begin to exceed it. However, it can only go as high as the limit your host has set on your server.
And this limit is often lower in many shared hosting plans. Hence, you will need to increase your PHP memory limit in WordPress and then check if your website is still getting the same 500 internal server error or not.
So to increase your PHP memory limit in WordPress, you will need to follow these steps:
- First of all, open your Root directory.
- Then you have to locate your WP-Config.php file.
- Now right-click on the file and select download. This will download the file on your computer.
- Now use your preferred text editor and open up the WP-Config.php file. Once done, simply paste this line of code into the file:
- After that, you will need to save the file and upload it back to the root directory. This will overwrite the original file.
Once done, go ahead and refresh your website and check if you are still getting the same error. If you still get to see the same error, this means you do not have any PHP memory limit issues.
So you better go ahead and remove the code from the wp-config.php file on your computer. And upload it back to the server.
#Method 3: Deactivate All Plugins:
If none of the above methods works for you, then maybe this problem was caused by the poorly coded plugin and some other plugins. It might be a good option to deactivate all plugins from “public_html>wp-content>plugins” folder.
If one or two of your plugins are not working nicely then it too causes 500 internal server error. Deactivate plugins from “public_html>wp-content>plugins” folder and try reload your website.
If deactivating plugin solves the problem, then you came to know that one of your plugins cause this error. Simply activate plugins one by one to know which plugin causes this error and remove the infected plugin and report to its author.
Updating Core Files:
If none of the above methods works then try to overwrite WordPress core files, i.e; “wp-admin” and “wp-includes” folder. You can simply install a fresh WordPress on any subdomain or other domain and move the fresh installed “wp-admin” folder and “wp-includes” folder to the main site folder.
Replacing “wp-admin” and “wp-includes” folder wouldn’t affect the website and database. It would help you to resolve corrupted files and fix the problem that causes HTTP Error 500.
Clear Your Browser Cache
There is also a possible chance that the issue is fixed on your website. But due to cache, you see the same error again and again. And in this case, you can simply clear your browser cache.
If you are using Google Chrome, then you can simply copy and paste this URL in your chrome browser:
After that, click on the Clear data button, and it will erase all the cache on your website. Finally, try loading your website and see if it has fixed the issue or not.
Contact ISP or Hosting Provider
In case if you are an owner of the website, but you do not have access to the web server’s logs and filesystem. Then you should go ahead and contact your ISP/Hosting provider for further details of the logs which you can investigate.
Some ISPs/Hosting providers do offer you access to different tools via the Control Panel only. So you can easily get all the details that you are looking for. Also, there are hosting providers who simply do not offer you access because of security reasons.
Even, there is a high chance that the issue is at the Hosting provider’s end. Maybe they are upgrading the server or any software. And as a result, you are getting the HTTP Error 500 on your end.
Hence, it would be a good idea to contact your hosting provider and check if they can help you to fix the issue or not. Even, there are quite a lot of hosting providers who will have their help articles for the same.
So you better contact them and see what they have to say about the problem.
Contact CMS provider
Apart from the hosting provider, you can also try contacting your CMS provider. In case if you are using a content management system like WordPress, Joomla, or other content management systems. Then you can ask them for further help.
Most of the CMS providers will have help pages on the websites which you can check out for details. Even, you can also try asking about your issue in the official forum and see if you get any help from there.
How To Fix HTTP Error 500 or 500 Internal Server Error | Short Video Guide
So that was the answer to your HTTP Error 500 – Internal Server Error and How to Fix This question. As mentioned earlier, the error can appear because of multiple reasons.
So you have to go try out different things to fix the issue. Anyway, now go ahead and check these methods out and see how it is working for you.
Also, if there is anything that you would like to ask, then do feel free to comment below. And I will surely help you out with your query.
- Proven Ways to Rank #1 On Google Search Results - June 15, 2020
- How to Create an Event Blog in 2020?💸 A Beginner’s Guide to Event Blogging - June 9, 2020
- I Bought A Domain Name Now What? 7 Amazing Things To Do (with Bonus Tips) - April 30, 2020