How to Fix 500 Internal Server Errors
How To Fix 500 Internal Server Error
- Back-up your site.
- Enable debugging in wp-config.php.
- Reset .htaccess file.
- Increase PHP limit.
- Revert to default theme.
- Check your plugins.
- Ask your hosting provider.
What is a 500 Internal Server Error
We’ve all at some point in our WordPress site careers have seen the dreaded “500 Internal Server Error”. It is one of the most common errors that can occur when running a WordPress site and can be very intimidating for a lot of WordPress beginners who do not know how to fix it.
The 500 Internal Server error comes in many forms and happens to all websites, but all have the same basic purpose. They tell you that something has caused an error when your server tried to execute code. Simply meaning that something in the server is broken and caused it to fail to run your site.
The HTTP documentation for this error simply says “The server encountered an unexpected condition that prevented it from fulfilling the request.” The reason this error can be a pain is that, as stated by the documentation, there is no specific reason causing the error. This means it can be very hard to identify the exact cause for the error.
Due to the very generic nature of this error, it can be hard to identify the specific reason that you’re site is down. Though, we have boiled down the four main reasons that can cause it on a WordPress site. It can be a nightmare to troubleshoot but if you follow these steps then you can quickly fix it without tinkering too much with your site.
Causes for this Error
Over the years that WordPress has been around, there have been countless things that have caused 500 internal server errors for people that can range from a simple plugin to a corrupt .htaccess file. Thankfully, for WordPress users, the reasons for this deadly error have been boiled down to four main reasons.
WordPress already has measures in place to prevent any other causes for this error, so there are only four things that can cause this error for the average WordPress user. These four things are plugins, themes, the PHP memory limit, and a corrupt .htaccess file.
A broken plugin is one of the most likely reasons for this error to occur. If it is a plugin, then there is some code in the plugin causing your WordPress to fail when starting up. Themes can also be an important cause for the 500 internal server error, though unlike plugins, they are much more simple to fix.
The PHP memory limit is how much memory your site can use for PHP scripts. This limit is usually set to 64 megabytes but can be changed easily through some basic editing. The last reason is a corrupt .htaccess file, which can be lethal because the .htaccess holds some of the most crucial code for your site.
Most of the reasons that cause the 500 Internal Server Error can be traced back to some code that is broken. So when you will be editing the code to fix this problem, you must know how to do two things: backup your WordPress site and use an FTP client or cPanel to access WordPress server files.
You can use a plugin or your hosting platform’s site to back up your WordPress site. This is important because if you mess anything up or create more problems then you use the backup. You can use an FTP client like FileZilla connected to your WordPress server to edit and change the files there.
Furthermore, the last thing we recommend if none of these solutions work is to contact your hosting provider for support. They are already experts on the topic and have the tools to fix any problems, so it is really important to ask them for help if nothing here works.
Before you can start fixing this problem, go ahead and make sure to follow the last steps and set up your FTP client if you do not have a cPanel. Then we can move onto the next step of the process which is enabling debugging on your site. This will important in identifying the specific root of the problem.
The first and most important step to start fixing your problems is turning on debugging. This is vital because if you turn on debugging then WordPress might display a more specific error code and tell you what is causing the problem.
To turn on debugging you must edit code on your site’s core code files. This may seem dangerous, but if you follow these steps correctly there will be no problems. To start go to your FTP client or cPanel and navigate to your strongb>site’s core files.
Start by finding the file called wp-config.php file.
Open the file and then find the section with WP_DEBUG.
Set the value next to that word to true.
If you cannot find it then you must create it yourself.
Find space above the line:
/* That’s all, stop editing! Happy blogging. */
Then above that line put the following code:
define( “WP_DEBUG”, true );
Save and exit your files.
Once you have completed these steps, debugging should have been enabled. This means that now if you reload your site it might show a more specific error message. Once, you reload your site check for what error is displayed. If it is another error instead of a 500 internal server error then you can look that up and solve it.
If the error that is displayed says that a certain plugin(s) is causing the problem, then you can deactivate those plugins and solve the issue. If there is an issue with the theme of the site, then you can just revert to the default theme or change it to another theme.
Debugging can be a great tool for troubleshooting because it can tell you what exactly is causing the issue most of the time. If even after enabling debugging the error shows up with a 500 internal server error then move on to the next couple of sections.
Once you are done trying everything here or have fixed your problem, just make sure to turn off debugging after. To do this, simply just go back to the file and change the value next to WP_DEBUG back to false.
Fixing .htaccess File
For those who do not know, the .htaccess file is one of the most essential files for your WordPress site and is found with the rest of the core files in your WordPress server’s files. It, like the other core files, uses code to fill out some very key roles for your website.
By default, the file mainly helps with changing the function of URLs and permalinks in your site. Though when edited, it can prove to be useful in many ways. It can assist you in redirecting between sites and improving the encryption and security of your site.
These functions make the .htaccess file crucial for your WordPress site. If your .htaccess is corrupted, then many of your site’s functionality will be lost or broken. It is an important component of your site that should never be tampered with.
The most likely cause of the corruption of the .htaccess file is usually from a plugin or direct code editing. This problem can be easily fixed though, all we need to do is back up the file, reset it, and check for further issues.
First, use your FTP or cPanel to find the .htaccess file.
Then make a copy of the file by downloading it.
Delete the file in the WordPress server.
Reload your site and check for issues.
Now that you have made a backup of your .htaccess file, you can check the status of your site. If you do not have custom rules or code for that .htaccess file then you can create a new .htaccess file. Follow the steps below:
Go to Settings on your dashboard.
Then go to Permalinks.
At the bottom, don’t change anything and click Save.
If you have custom rules then you can open your backup and go check every line by adding them into your new file. This is a very timely process but is necessary for clearing up any issues in your .htaccess file. Once you have checked all of your custom rules and know that they work, you can save the file and exit.
Increasing PHP Memory Limit
The PHP memory limit acts as a sort of RAM for some parts of your site. The PHP memory carries the code for plugins, themes, code, and anything else that your site uses to operate. The memory limit is how much memory your site can use.
The PHP memory is what allows your site to handle multiple tasks and functions at the same time. Since in this error, too much of your memory is exhausted, you have to use more memory, so we will have to raise the limit to allow your site to function correctly. This can be one of the most prominent causes of 500 internal server errors.
The memory limit is tied to how much memory is apart of your hosting plan. Thus you should be careful as to how much you change it. By default, the most WordPress uses is 64MB, though most of the time that is not enough. To increase your memory limit follow the steps below:
Access your WordPress files through cPanel or an FTP.
Find the wp-config.php file there.
Open the file and go to the part that says:
‘That’s all, stop editing! Happy blogging.’
Once there, put this code above that text:
define( ‘WP_MEMORY_LIMIT’, ‘256M’ );
Save the file and exit.
Once finished, your memory limit should have been increased to 256MB. This will allow most people’s sites to function properly and handle all of the plugins and complex features. Reload your site and check if you still have a 500 internal server error. If you do, then proceed to the next section.
Fixing Plugins & Themes
Plugins can change almost everything about your site, so they have the power to alter the code. Plugins can add a lot of functionality and useful features to your site, though they can also cause a lot of problems. Many plugins will change code in your WordPress site, which may break it.
Although most plugins nowadays are mostly error-proof and programmed very well, they can break your site’s functionality and cause some major issues if they are broken, incompatible, or outdated. This can become of the primary causes for the 500 internal server error.
Furthermore, themes can cause similar problems because they can also change much of your site’s core code. They can alter some key parts of your site leading to problems if they are buggy, broken, or outdated. However, unlike plugins, themes are easier to work with because you can only have one active.
To fix your plugin problems, go to your WordPress dashboard. Afterward, go to your plugins section and deactivate all of them. Activate each plugin one-by-one until you figure out which one is breaking your site. If your plugins were not causing the issue, check your theme.
For themes, all you have to do is just switch to another theme or the default theme. If your site works then it was the theme causing the issue. If not, then move onto the next section.
Ask Your Host
The best thing to do if you are still getting the 500 internal server error, the next best thing is to ask your hosting provider for support. Most host providers offer great support along with your plan. Since they are the ones hosting your site, they can also help you get it fixed.
They are already experts at what they do and know how to troubleshoot errors, so it wouldn’t hurt to ask your hosting provider. They will help you get your site up and running again as soon as possible.
Ask An Expert
If you don’t have time to debug such issues, it would be wise to hire an expert developer to solve the problem for you.
Our company offers the best WordPress technical support service that covers all technical bugs and database issues that might encounter your website.
We also offer a complete all-in-one WordPress maintenance service that puts your whole website on autopilot. Basically, our company will take care of your website on a daily basis.
Your Perfect Solution
Having to deal with things with technical problems and errors can make using WordPress painful. Though we have the perfect solution for you!
Our top of the line WordPress solutions have you covered for everything from themes and plugins to live support. With us by your side, you will have a clean, optimized, and polished site in a couple of days!
Best Collection Of WordPress Guides & Checklists
Our complete and latest collection of WordPress guides and resources that cover everything you need to get the most out of your WordPress website.
Download Them All!
All of our guides will be sent to your inbox