How to Fix an Internal Server Error in WordPress

Andy Holland

Running your own website through WordPress comes with its own range of issues. You need to make sure that you are able to fix many of the minor issues as they occur. Trying to fix an internal server error WordPress throws forward can be a little tricky. Here is a guide to how to fix one of the most common issues you might face, the HTTP error 500 WordPress users sometimes encounter.

What is the 500 Internal Server Error?

It can be a little tricky to define the 500 internal server error properly. Unlike other errors you might face, there is no definite way to know precisely what causes it. It is not unique to WordPress alone and many other sites will often face this error. However, because it is so generic, it does not help diagnose what is wrong with the website.

Luckily, there are several places you can check as the most likely places to throw up this error. This will be your best bet for trying to fix the error on your own. When considering WordPress, this error is usually caused by an operation not working properly and so causing the error. This is usually due to a script in your theme or a plugin misbehaving.

How to Fix the Error

There are several ways how to fix an internal server error WordPress can offer you. You can often fix the issue easily in just a few steps.

Step 1 – Turn on Debugging

The first thing you should always do is switch on WordPress’s debugging mode. It is not going to do anything to help solve the error but it might help you to determine where the error is. You can turn on the debugging mode by editing the site’s wp-config.php file. Search for WP_DEBUG inside and set this to true or create the setting yourself if it does not yet exist. Once you are finished, this line should read – define( "WP_DEBUG", true );

Reload the site and you will hopefully get a new error which tells you where that error is. If it is just the one plugin, all you need to do is disable it. When you have finished fixing the error, remember to deactivate the debugging mode again.

Step 2 – Deactivate the Plugins

If you aren’t sure which of your plugins is causing the issue, the next step should be is to turn them all off. Check your site again with a quick reload; if it loads fine then you will know that it is indeed one of the plugins. All you need to then do is switch them on one by one and reload the site in between. This will quickly allow you to determine which of the plugins are being problematic. 500 internal server errors are usually caused by plugins so this will be the fastest way for you to solve the problem.

Step 3 – Change the Theme

Bad scripts in custom themes are also a common problem which could cause an internal server error. If you think it might be your theme which is causing the issue, the fastest way to test this is to switch to one of the default WordPress themes. These will be bug-free. If your site loads correctly with the default theme installed then you can either try to fix the broken script in your preferred theme or you can try to find a new one.

Step 4 – Check Your .htaccess File

The .htpaccess file is the guide which allows your server to know what to do in certain situations. One of its primary uses is to prevent malicious parties from having access to your site. Due to this, it can sometimes cause the site to crash.

You will need an FTP editor which lists hidden files before you are able to check your WordPress root folder to see if you have one of these files. If you do have one, make a backup and then delete the entire file. Should the site load correctly, you will know that this is the issue. You can then restore the file and work out where the error is inside it precisely. It may even be so little as a single line of code.

Step 5 – Increase Site Memory

A temporary fix might be to attempt to increase your site memory as you might be exhausting your PHP memory limit. To fix this, you will once again have to open your wp-config.php file and search for the WP_MEMORY_LIMIT. Change the value here to a higher value. This line might not always be present. If this is the case for you, you can just paste in the following: define('WP_MEMORY_LIMIT',
'64M');

This is very much only a temporary fix as it means you have a faulty piece of code somewhere else. You also need to check your plugins to see if something is eating up the site memory.

Step 6 – Ask Your Host

If you have followed all the steps so far and you have had no luck, there might be an issue which is outside of your control. In this scenario, you should contact your host. They will be able to take a look at the server from their end and they might find the issue there. It also might be some issues with file permissions which they will be able to fix for you.

Step 7 – Reinstall WordPress

If the above steps have still not produced a solution, you might want to try reinstalling WordPress. This could resolve the issues you are facing, especially if they are file permission errors, but it should be one of your last resorts.

Trying to fix a 500 internal server issue can be difficult as it is not always easy to determine where the issue is. The steps above should help you to find it and solve it by yourself, though you can always contact your host if you need some more help. These errors are some of the most common a WordPress site faces so make sure you know how to fix them.