Reasons for 500 Internal Server Error in WordPress

SUMMARY

COMMOM REASONS

  1. Corrupt htaccess file.
  2. Faulty Plugin
  3. Exhausted PHP Memory Limit

SOLUTION

  1. Regenerate htaccess file.
  2. Detect Culprit Plugin and Deactivate it
  3. Increase PHP Memory Limit.

As the name suggests, the 500 Internal Server indicates that there is something wrong or misconfiguration on the server side. It can be because the server is unable to handle the request due to memory limitations and it can also be because of corrupt code that the server can not understand especially in the server configuration file.

Some of the common reasons and their fixes are below:

Corrupt Htaccess (Server Config File)

The most common reason for the 500 Internal Server Error is a corrupt htaccess file. The misconfiguration in files can be due to 3rd party plugins installed on your site.

If you can access your wp dashboard then you can regenerate htaccess file by simply going to Settings > Permalinks and pressing “Save Changes”.

If WP Dashboard is not accessible then you can edit the htaccess file in the root folder through FTP or through File Manager(If your hosting has CPanel) and replace the code with below code:

# BEGIN WordPress

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Faulty Plugin

A plugin can also be responsible for 500 Internal Server Error. In most cases, those plugins which modify the htaccess file are the culprit ones. Examples of such plugins are cache plugins like WP Rocket, WP Fastest cache etc. Plugins that add Redirect Functionality or SSL plugins can also be the culprit ones.

To detect the culprit plugin, deaactivate all plugins and then activate them one by one and reload site each time you activate plugin. If you can not access WP Dashboard then you can deactivate all plugins by renaming “Plugin” folder name in wp-content directory. You can rename it to anything like “Plugin-1” or “Plugin1” etc. After renaming make sure to rename it back to original “Plugin” before you start activating plugins back.

Exhausted PHP Memory Limit

If the PHP memory limit is not enough to handle the request or any processes running on the server, it can also result in 500 Internal Server Error.

To increase the PHP memory limit you can add the below line of code in wp-config.php file just before the line that says ‘That’s all, stop editing! Happy blogging.’

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

If none of the above solutions worked then you can contact your Hosting Support for further investigation.

You can let me know in the comments box if you have any questions.

Leave a Reply

Your email address will not be published. Required fields are marked *