Internal server errors in WordPress are the worst (aka. http error 500), compared to other HTTP error codes and status codes. They provide no real information about the problem and are rarely actual server errors (ie: usually your server is working fine).

In this article, I’ll try to make sense of this internal server error in WordPress and show you how to get rid of it:

What is the 500 internal server error

The web definitions of the 500 internal server error are rather unclear. Basically, there’s no real indication as to what really went wrong and caused the error.

The only thing that’s certain is that the error is caused by some operation that went wrong on the website’s end. Particularly in WordPress’ case, this can mean that a script that’s part of a theme or a plugin did something it shouldn’t have done, and now your server has crashed.

Don’t sweat, though, there are some good solutions…

How to resolve 500 internal server error

Most of the time, you can have the 500 internal server error solved in 6 steps:

1. Turn on debugging

Whenever WordPress throws you a white screen of death or a server error, I recommend turning your debugging on. While this may not fix the problem, it may give you more insight into what’s going on.

You can turn debugging on by editing your site’s wp-config.php file. Once you’ve accessed this file, search for WP_DEBUG within. If you find it, you should be able to set it to “true”. If you don’t see it in there, you’ll need to create it yourself. Either way, at the end of the day, you should have a line that looks like this:

define( "WP_DEBUG", true );

Once saved, reload your site to see if anything has changed. If you’re lucky, the server error may disappear and might be replaced with a different error, one that actually tells you where the issue is.

If this is the case, take a look at where the error is located. If it is within a plugin folder, disable that plugin, the error should go away.

Even if turning on debugging doesn’t give you a great result, it is a good idea to leave it turned on until the issue is resolved. It will give you and any developers more insight into what’s going on. Don’t forget to turn debugging off once everything is a-ok and you’re done with the maintenance!

2. Deactivate all plugins and switch themes

If you have access to your dashboard, you should deactivate all your plugins and see what’s what. If your website loads without the server error the issue was with one of your plugins. You can switch them on one-by-one to figure out which one caused the issues.

You can also switch your theme to a default, unaltered WordPress theme like Twenty Fifteen or Twenty Sixteen. If the site loads without the internal server error, the issue was within your theme.

I’ve noticed that quite a few of these errors are actually caused by plugins, so this will be your best bet.

3. Check your .htaccess file

The .htaccess file, if it exists, contains a number of rules that tell the server what to do in certain circumstances. It is commonly used for rewriting URLs or preventing access to your site for malicious intent.

Use your FTP editor and check if you have an .htaccess file in your WordPress root folder. You may need to make sure your FTP editor lists hidden files before you do this.

If there is an .htaccess file there, make a backup and then delete all the contents within, or the whole file. This may remove some important rules, but if the internal server error was caused by a mistake within the file, this will tell you.

If the error is now resolved, the issue was with the .htaccess file. Try restoring the file and then deleting blocks of it. If at some point the site starts working, you know which block the issue is in. You can narrow it down to a single line like this usually. You can then remove that line or ask your developer or your host for further assistance.

4. Increase your memory

I’ve never personally run into this issue, but I’ve heard that increasing your memory limit may help – I assume this is more of an issue in shared environments. To get this done, open your wp-config.php file in the WordPress root directory and search for WP_MEMORY_LIMIT. If it exists, change the value to something like “64M”. If it doesn’t, paste the following line into the file:

define('WP_MEMORY_LIMIT', '64M');

If this works then you’ve only solved the issue temporarily. Chances are that you have a faulty bit of code somewhere (which could be a third party plugin) that is exhausting your resources. If your host has monitoring available, take a look at your resource usage with various plugins on/off to get a better idea of what is wasting those precious megabytes.

5. Ask your host

There are a few uncommon issues which can lead to internal server errors in WordPress, but at this point it may be best to ask your host. The issue could be a genuine server issue, which they can at least confirm and they can also look at things like file permissions and other sources.

6. Reinstall WordPress

I shouldn’t think this would help in most cases, but there are some edge cases where a reinstall of WordPress could fix the issue. It may even fix file permission problems along the way.

Summary

Internal server errors in WordPress are usually not caused by actual server faults. Most of the time, they can be corrected relatively easily using the methods described above. If in doubt, always ask your host, they have far more sophisticated tools than you do to locate and fix issues.

I always recommend switching on debugging while you’re working things out and ruling out plugin and theme issues since this is what any support technician would ask your to do first, or they would do it themselves.

Bu cavab sizə kömək etdi? 2 istifadəçi bunu faydalı hesab edir (72 səs)