In this article, we will discuss a common problem in the hosting world; the 500 internal server error. But what is indeed a 500 internal server error in WordPress and how can you fix it?
Actually, web definitions seem to be unclear about what a 500 internal error really is. But, we can say that is a generic error that you or your website’s visitors can encounter. Error 500 or other internal server errors in WordPress are the worst compared to other HTTP error codes because they provide no real information about the problem. So basically there is no indication as to what went wrong or what really caused the error.
The ‘500 internal server error’ occurs when something is wrong with the server or the file system that’s powering your site. Often, this error may be due to a script error, misconfiguration of your web hosting, and it is also caused by plugin or theme functions. This problem, particularly in WordPress means that your server has crashed, so it is unable to show the request page. No need to worry, because we already have the solution for you. So, here you have a 6 step guide on how to resolve this issue and get rid of the ‘500 error’.
First: Turn on debugging
Once WordPress throws you a white screen death (server error), we recommend turning your debugging on. This may not fix your problem, but by doing this you can get more insight into what is going on.
So, this is how you can turn your debugging on:
- Edit your site’s wp-config.php
- Search for WP_DEBUG within the file.
- Find it and set it to ‘true’ (otherwise you need to create it yourself).
After doing all this, you should have a line look like this: *define ( “WP_DEBUG”, true) ; * Click save and then reload your website to see if the changes are made. Luckily, the server error will disappear and might be replaced by another error that can really tell you where the problem is. In this case, you will be able to see where the problem is located, and if it is within a plugin folder, the error will go away.
Even though turning on debugging might not solve your problem, we suggest you leave it turned on until you get rid of this issue. That’s because leaving the debug turned on will give you (and any developers) more insight to understand what is going on. Once you are done with the maintenance and everything is back to normal, feel free to turn debugging off.
Second: Deactivate all your plugins and switch themes
Go to your dashboard (if you still have access), and deactivate all plugins to see what is happening. After that, if your site starts working, it means that the server error issue was caused by one of the plugins. So to figure out which one caused this error, you have to switch them one-by-one.
Another way to fix this server error is to switch your theme (unaltered WordPress theme like Twenty Fifteen or Twenty Sixteen) to a default. So again, if your website loads without the internal server error, you will realize that it was the theme’s fault. In fact, we have noticed that these errors are mostly caused by plugins so you better keep your eyes open!
Third: Check your .htaccess file
The .htaccess is commonly used for rewriting URLs, also for preventing access to your site for malicious intent. It contains several rules related to how the server should operate in certain circumstances. To see if you actually have a .htacces file, use your FTP editor and check it in your WordPress root folder. But before you do this, you have to make sure your FTP editor lists hidden files.
So after you realize that you have one, make a backup and after this delete all the contents or event the whole file. This will tell you if the internal server error is caused by a mistake within the file, even though this may remove some important rules on it.
If you get to resolve this problem and realize that the issue was with the .htaccess file, try restoring the file. After that, you can delete blocks of it, and if your site loads, you will know within which block is positioned the problem. You can narrow it down to a single line, remove it and after doing that, ask your host for further assistance.
Fourth: Increase your memory limit
Increasing your memory limit can help you especially if you are dealing with this issue in shared environments. To do this you should follow these steps:
- Open your wp-config.php file (you can find it in your WordPress root directory).
- Search for WP_MEMORY_LIMIT (if it exists).
- Change the value to something like “64M”.
If it doesn’t exist, paste the “define (‘WP_MEMORY_LIMIT’, ‘64M’); “line, into the file. Anyway, if this works out for you, you only have solved the issue temporarily, and you have a faulty bit of code still in there. This might be a third-party plugin, and it is really exhausting your resources. In case that your host has monitoring available, go and take a look at your resource usage with various plugins on-off. This will give you a better idea of what is really happening and what is literally wasting those precious megabytes.
Fifth: Ask your host
Some possible causes of internal server error in WordPress can be issues like a corrupted .htaccess file and PHP memory limit, but they can also be caused by plugin or theme functions. The ‘500 internal server error’ indicates that the server encountered an unexpected condition, and it is unable to fulfill your request, so at this point, you better ask your host. The minimum that they can do is confirmation, and they can also look at things like file permission, as well as other sources.
Another thing to do is to switch to a better host that has servers that are optimized for WordPress and in this way, you will also improve your website’s performance. You don’t have to spend much for that as you can get a reliable WordPress experience for as little as $0.8 per month.
Sixth: Reinstall WordPress
Reinstalling WordPress is probably the best solution in most cases, but still, there are some cases that even this would not help. Anyway, this may fix the file permissions problem that you can encounter along the way. You can reinstall WordPress by following the manual WordPress Update instructions in the WordPress Codex.
A brief summary
One thing to know is that server problems are not always caused by actual server faults. However, there is no need to panic because you already have the solution in your hand (use the methods above). But anyway, feel free to ask your host because they can provide more sophisticated tools for you to locate and fix issues. Switching on debugging as you are trying to solve the problems and ruling out plugin and theme issues while you are working things out, are considered the first things to do in situations like that. Don’t worry if you cannot solve the problem by yourself, the technician support team can do it for you.