Fixing Internal Server Error 500 in WordPress

Server Error 500, also referred to as 500 Internal Server Error is probably the most annoying error you can get, on WordPress in particular, and on websites in general. Server Error 500 basically means that something somewhere went wrong.

Typically, you will receive no details about what went wrong when you experience this error—only a white screen or the following error message:

A typical 500 internal error message

A typical 500 internal error message

How can you know what went wrong and how to fix it when you encounter that error? Let’s look at the steps that need to be taken in order to understand what causes this error and how to fix it…

Is a plugin on the site causing Error 500?

If you’ve just installed a new plugin or your site is showing a 500 error after you updated or upgraded your WordPress version, then the problem is most likely related to that plugin or another plugin installed on your site.

Identifying the problematic plugin would be simple if the error appears right after activating the plugin. But how can you disable that specific plugin if you don’t have access to the WordPress dashboard? And what if you have no idea which plugin produced the error?

In both cases, you will most likely need FTP access to your server, but the file manager in cPanel or Plesk should also be sufficient in order to find the problematic plugin.

So, If you know which plugin caused the problem, just go to the wp-content/plugins folder and delete the plugin.

However, in cases where you don’t know which plugin is causing the error the first thing you need to do is to change the name of the plugins folder. Add an underscore at the beginning, it should look something like this: _plugins.

Is a plugin cause the internal server error 500?

Changing the name of the folder will deactivate all the plugins on your site at once, so if the problem is indeed one of the plugins, you will be able to access the WordPress dashboard again.

Once you go to the WordPress dashboard, you will receive comments on the plugins page such as the following:

"The plugin something.php has been deactivated due to an error: Plugin file does not exist."

But don’t worry, all of the plugin settings are saved in the database and the majority of them will have exactly the same settings after re-activating them.

The next step is to rename the folder back to its original name by removing that underscore, and then activate the plugins one by one until you find the problematic plugin.

When the site will throw a 500 error again, repeat the whole process, but this time don’t activate the plugin that causes the error.

Is the activated theme causing the internal server error?

If deactivating the plugins didn’t work, the problem may be with the active theme on your site. If so, just as you did with the plugins, start by changing the name of the active theme folder via the FTP so that the default WordPress theme will be automatically activated.

This is by the way the main reason you should leave the default WordPress theme on the site.

The themes folder is called themes and is located in the folder wp-content.

Internal Server Error 500 caused by your theme

If that solved the problem and you were able to access the WordPress dashboard, the issue was likely with the theme you are using. However, if you are still experiencing a 500 error and can’t access the dashboard, you should proceed to the next steps.

At this point, and if you are not the one who made a change to the theme that caused the problem, you have three options:

  1. Look for a new theme.
  2. Contact the theme developer for help.
  3. Try to fix the problem yourself.

To provide more information to the theme developer or fix it yourself, see the section in this post about enabling Debug mode in WordPress.

Is the .htaccess file causing a 500 server error?

If turning off the plugins and the template didn’t solve the problem, it’s likely that the problem is in the .htaccess file. This file is usually at fault when you can access the admin interface but not the site itself.

The .htaccess file manages (among other things) the conversion of permalinks to standard WordPress addresses.

To check if this file is the problem, access the main WordPress installation folder via the FTP and rename the file to .htaccess_old.

Bare in mind that you must enable the “show of hidden files” option on your FTP application if you don’t see the file in this folder. Doing so may vary among different FTP programs, so you might want to look online for instructions on how to do so.

After changing the filename, go to the WordPress dashboard, then navigate to Settings > Permalinks, and click the Save button without making any changes to the settings.

Can you find what caused Error 500 by turning on Debug mode?

You can enable Debug mode in the WordPress configuration file (wp-config.php). In Debug mode, you may find clues about the cause of the problem. But at this point you will have to figure out for yourself how to find and fix the problem, which will probably require you to have programming skills.

The wp-config.php file is in the main folder where WordPress is installed.

To enable Debug mode, edit the file and look for the following line:

define( 'WP_DEBUG', false );

If your site traffic is low and you don’t mind that users who access the site during your tests will see error messages, just change the word false to true. In this situation, you will see the errors on the screen when you try to access the site.

If you want to hide the error messages from site visitors, add the following lines after that line mentioned above:

define('WP_DEBUG_DISPLAY', false);

In that case, the errors will be written in the log file inside the wp-content folder and named error.log.

Turn on WordPress debug mode and show the errors

If you refresh the list of files in your FTP program and you don’t see this file after a short time, WordPress might not have permission to create this file. In this case you must create the file yourself and give it 666 permissions.

In the log file, look for a line containing the phrase PHP Error to understand which file is causing the problem.

Note that you should look for PHP Error, not PHP Notice.

Remember, this file will grow with every comment or error that is written to it in this state. Make sure you remove the lines in question from the wp-config.php file after you have finished the debugging process.

Can incorrect server settings cause the Error 500 error?

Perhaps you run your own virtual private server (VPS) and you have changed something in the server settings. Perhaps you’ve installed an extension on the server. Either of these actions may be the cause of the 500 errors on your site.

An Internal Server Error can happen due to a combination of incompatible server settings. If you are using a managed server, this is probably not the issue, but if you are responsible for the server and its settings, it’s your responsibility to check that everything is working properly and there are no compatibility issues.

Is your website running out of memory?

If your website is hosted on a shared server, the time may come when there is not enough memory to support your website (PHP Memory Limit). WooCommerce sites, forums, or even certain plugins can eat up memory due to their complexity.

In this case, you might receive a message like this one:

"Fatal Error: Allowed memory size of xxx bytes exhausted".

You can fix this problem by adding the following line to the wp-config.php file we mentioned earlier:

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

Note that some hosting companies prevent you from changing the memory limit if it is a shared storage server. In this case, you may want to purchase a more powerful server.

In conclusion

The best protection against any problem or critical error on your WordPress site is to maintain daily backups as well as a proactive backup before making any major changes (such as upgrading your WordPress version).

In Addition, you should always keep the version of WordPress and the plugins you use up to date with the latest version.

Good luck 🙂

Roee Yossef
Roee Yossef

I develop websites & custom WordPress themes by design. I love typography, colors & everything between, and aim to provide high performance, seo optimized websites with a clean & semantic code.

  • Roee Yossef 17 December 2022, 11:05

    Hey Guys,

    This is my first post in english, expect more to come as i translate the rest of the blog posts from Hebrew to English 🙂

Leave a Comment

Quick Navigation