A New User’s Guide to Fixing the 500 Internal Server Error on WordPress

500 internal server error wordpress

Did you know that unplanned downtime of your website can cost about €17,000 per incident?

For example, if your visitors see the 500 Internal Server Error WordPress issue on your site, they will go elsewhere instead. Some might assume that the site is permanently gone. You’ll then lose the profits you would have made during the time the error is up.

It’s important to fix the issue as soon as you catch wind of it, but it’s not always that easy to do. How would you know what caused this issue and how would you fix it? Find out the causes and the solutions by reading on below.

First, Back Up Your WordPress Site

Before we move on to the solutions, you must take this important step first. Fixing the WordPress error 500 requires you to make some changes in the root directory. One misstep and you could damage your site, making it important to have a backup.

You may back up your WordPress website to cloud services like Dropbox using plugins. There are also others that allow you to back up to your hard drive, FTP, Stash, email, and such. Examples are UpdraftPlus, BackupBuddy, Duplicator, Online Backup for WordPress, and more.

How to Fix 500 Internal Server Error

Once you have backed up all your files, it’s time to see what’s the root cause of the error 500 on your website.

A 500 internal server error means there’s a problem, but unless there’s a specific number following 500 (such as 500.19, which means the configuration data is invalid), it doesn’t specify the cause. The 2 most common causes, however, are a corrupted .htaccess file and PHP memory limits.

Create a New .htaccess File

Making some changes on your site or even installing a plugin might corrupt the .htaccess file. The usual culprits are a module or a broken installation of a new WordPress theme. To determine whether this is the case, rename the file and then reload the page.

To do this, open your WordPress root directory using an FTP client. The file would be in the WordPress folder, which also contains wp-admin, wp-content, and such.

When you reload the page and it fixes the error, then you’ve found the cause. All that’s left to do is to create a new one, which you can do by going to your WordPress admin area. Go to Settings > Permalinks, and search for the Save Changes button.

Clicking this button will then allow WordPress to generate a new .htaccess file. It will follow the proper rewrite rules, ensuring you won’t get a 404 error instead.

Another way, albeit long, to go about is by deleting the file itself after making a backup. If that fixes the issue, you may restore the file and then remove one block at a time.

If the error goes away at some point, you would have found the exact block causing the problem. Continue on removing that block or ask for help from your developer or your host.

Increase Your PHP Memory Limit

Both WordPress and your host set PHP memory limits on your website. WordPress can increase your limit but only as high as the host’s limit. The host determines the limit based on your plan; you’ll likely have a lower limit if you’re on a shared hosting plan.

To test whether the error is a PHP memory issue, first increase the limit in WordPress. Again, you’ll have to access your root directory and then locate one of the following files:

  • Functions.php
  • .htaccess
  • Wp-config.php

First, right click on any of these files and then download it to your hard drive. Open the file using your preferred text editor and then add a specific code.

For the Functions.php file, you need to include the following code below the opening tag of PHP:

@ini_set(‘upload_max_size’ , ‘64M’);
@ini_set(‘post_max_size’ , ‘64M’);
@ini_set(‘max_execution_time’ , ‘300’);

For the .htaccess file, add the following code below the opening tag of PHP as well:

php_value upload_max_filesize 64M
php_value post_max_size 64M

For the wp-config.php file, search for ‘WP_MEMORY LIMIT’ and then change the value to 64M.

Aside from altering one of these files, you may also create a PHP.ini file to increase the memory limit. Create a blank text file and name it PHP.ini and then type in the code: memory=64MB. Save this file and then upload it to the wp-admin folder in your root directory.

If increasing the PHP memory limit worked, don’t rejoice too soon. This may only be a temporary fix as there’s likely something to be exhausting your limit.

It could be a theme or a plugin with poor coding. You may ask for help from your web hosting company, or you may ask them to increase your PHP limit.

Other Troubleshooting Tips and Solutions

If neither of the above solutions worked for you, proceed with the steps below to see what’s causing the error. You may also troubleshoot further to find the cause of your memory limit issues.

Audit Your Plugins

If you’re experiencing any issue with your WordPress site, plugins are usually the cause. Some may have poor coding or you may be using outdated ones that no longer support the latest version. This would lead to errors, including an internal server error, and it poses security risks as well.

If you have access to the WordPress admin area, you can deactivate each plugin to see which one is faulty. Deactivate the plugins one by one. Then, refresh your website after each deactivation.

If the error goes away after deactivating a certain plugin, it’s most likely the one causing it. If so, removing it from your website should fix the issue for good.

If the plugin is important for the function of your website, you can try to look for alternatives. However, another one might not replace the plugin you’re using in whole. In that case, you may try to contact the developer to see if they can fix the issue.

Another way to find the faulty plugin without accessing the admin area is by using your FTP client. Open it, then locate the wp-content folder in your root directory. This contains your plugins, themes, and such.

Look for the Plugins folder and rename it into something else. This will deactivate all your plugins. Then, refresh your website; if that fixes the issue, you have a faulty plugin.

Contrary to the method above, you’ll have to activate the plugins one by one. Make sure to refresh your website after each activation as well. Doing this, you’ll also be able to find which plugin is the one causing problems.

Don’t forget to revert the name of the Plugins folder into the original.

Upload Fresh Versions of Your Core Files

If you have good plugins, you may try reuploading your core files and see if that fixes the error. Your core files include the wp-admin and wp-includes folders. If corrupted files are inside, replacing the folders with new versions should fix it.

Don’t worry, removing these and reuploading fresh ones won’t erase your information. However, we recommend you only try this after you’ve exhausted the other options.

You’ll need to have a fresh copy of WordPress, which means you have to download it again from the website. After downloading, extract the zip file then open the WordPress folder within.

Then, connect your FTP client to your WordPress website. Look for the root folder, which contains wp-admin and wp-includes.

On the left side of the FTP client, navigate toward the WordPress folder you downloaded. It will contain the folders wp-admin and wp-includes as well.

Select these 2 folders, right-click, and select Upload. A window should pop up telling you the file already exists and asking you what action to take. Select Overwrite and then check the box saying “Always use this action.”

This will allow the FTP client to transfer these fresh copies of your core files to your server. Refresh the site to see if this solved the problem, and if not, you may have to contact your web host provider for help.

Debug Your Site

You may also turn on debugging to see if you can find the issue this way, although this step won’t fix it. This may also not be helpful enough if you’re not a developer and you don’t have enough knowledge about errors.

The reason is that there are errors that are negligible, while there are some major ones that need immediate action. You have to be able to set these 2 types apart if you’re to use this feature.

Furthermore, turning on the debugging mode on in a live website might reveal the code to visitors. For this reason and more, not everyone should attempt to do this unless there’s no other choice.

If you’re willing to take the chance, you can turn this built-in feature on by altering a piece of code into your wp-config.php file. Locate the file in your root folder, open it, and look for the bit with “WP_DEBUG.” If you find it, set it to “true;” otherwise, create the line yourself.

The code will look something like this: define (‘WP_DEBUG’, true);

Save it and then refresh your website to see the errors there. This may be able to point you toward the culprit, which you can then explore further to determine which one it is. For example, if the error is inside the Plugins folder, you now know which to deactivate.

If turning on the debugging mode doesn’t help you, it may help your developer or your host. Keep it turned on for them, it may be able to provide more insight to those who are more knowledgeable about errors. After fixing the issue, don’t forget to turn this feature off.

Check File Permissions

Incorrect file permissions may also be a cause of the error, although this is rather rare. Still, it doesn’t hurt to check your WordPress directory. Use your usual FTP client; it will help if it has a Permissions tab like Filezilla. This allows quick access to the permissions of each file and folder.

If your FTP client doesn’t have such a tab, you can view permissions by right-clicking and then choosing “File permissions.” Look at the numeric value; it should either be 755 or 644. Any value other than those 2 can cause problems, including an internal server error.

If there’s a file or folder with a different numeric value, change it to the appropriate number. Right click on your WordPress folder, then select “File permissions.”

Change the number to 755, the recommended value for folders. Then, check the box saying “Recurse into subdirectories.” Below, choose the option “Apply to directories” only.

After which, look for the index.php file within your WordPress folder and do the same thing. This time, change the value to 644, the recommended one for files. After which, click OK and exit.

Your host should be able to look at your file permissions if you’re not comfortable doing this yourself.

Contact Your Host

If all else fails, you may have to contact your web hosting provider. They’ll likely have the solution for the error. If you’re experiencing PHP memory limits, you may also ask them to look into the server logs to locate the culprit.

Note, however, that only proceed with this step if you’re sure the problem isn’t in your root directory. Based on your provider, they may instead try to blame your files for the error instead of trying to see if there’s a problem on their end. In their defense, third-party plugins and such are the usual causes of issues in your website.

Checking for yourself that this is not the case will help you and your host find out what may be the causing the 500 internal server error. Depending on the diagnosis, you’ll work together to solve the issue or you may have to upgrade your plan as in the case of an exhausted PHP memory limit.

Get Help on Fixing the 500 Internal Server Error WordPress

As you can surmise, having a quality hosting provider will help you get through any issue, including the 500 internal server error WordPress issue. Don’t let this error take traffic and conversions away from your business!

If you need only the best for your site, contact us now and let’s discuss how we can help you.