How To Fix The 500 Internal Server Error In WordPress

How To Fix The 500 Internal Server Error In WordPressPin
Pinterest Hidden Image

The 500 internal server error is one of the most frustrating issues you can have with your site. This error is an HTTP status code. All webpages produce them to let you know how your server is running.

Your server will produce a 500 status code when something is wrong but it’s not exactly sure what it is.

Before you attempt the fixes below, try waiting a bit before refreshing your site and clearing your browser’s cache to see if the error was a temporary issue after updating or an issue with your browser.

You should also check your server logs if your host provides them or turn on WordPress’ debug mode as these reports may pinpoint the exact issue.

6 ways to fix the 500 internal server error in WordPress

  • Delete your .htaccess file – Temporarily delete your .htaccess file and generate a new one to fix errors within it.
  • Increase your PHP memory limit – Raise your site’s PHP memory allowance in case a theme or plugin is exhausting its current limit.
  • Deactivate third-party plugins and themes – Rule out issues with plugin and theme files by deactivating both.
  • Correct errors with file permissions – Switch files over to a recommended permissions configuration.
  • Reinstall WordPress core files – Delete and reinstall primary WordPress core files that may have been corrupted.
  • Contact your host – Rule out server issues by consulting with your host.

Fix #1: Regenerate your .htaccess file

For whatever reason, your .htaccess file may become corrupted. You won’t find this file if your host uses Nginx instead of Apache, so go ahead and skip to the next fix if that’s the case.

If your host uses Apache and you don’t see the file in your root folder among your wp-content and wp-admin folders, make sure your FTP client is set to show hidden and/or dot files.

Download this file to your computer, then delete it from your site’s files and reload your site to see if the issue is resolved.

Save your permalink settings in WordPress to generate a new .htaccess file.

Fix #2: Increase your PHP memory limit

Poorly-coded plugins and resource-intensive plugins can cause you to hit the allotted PHP memory limit assigned to your site. The site will go down as a result.

You can move on to Fix #3 to find out which plugin is causing the issue, or you can increase your PHP memory limit to give your site more leeway.

There are a few different ways you can raise this limit. If your host uses cPanel, find the Select PHP Version app under the Software section, then click Switch to PHP Options, and change the value for “memory_limit” to 128M or 264M depending on its current limit.

You can also add a simple line of code to one of the following files:

.htaccess file in root folder:

php_value memory_limit 256M

php.ini file in wp-admin folder:

memory_limit = 256M

Note: This line doesn’t need to be added. Simply find it, and change its value.

wp-config.php file in root folder:

define(‘WP_MEMORY_LIMIT’, ‘256M’);

Note: Add this snippet before the “happy publishing” line.

wordpress increase php memory limitPin

Contact your host and request a raise to your PHP memory limit if you’re having trouble.

Fix #3: Deactivate plugin and theme files

If you can’t pinpoint the error, deactivate your plugins and third-party theme in one fell swoop. If your site loads, reactivate each plugin one at a time to pinpoint the error.

If you can access the WordPress dashboard, go to the Plugins page, check the Select All box, and apply the Deactivate action.

deactivate wordpress plugins dashboardPin

To deactivate your theme, head to the Themes page, and activate a default WordPress theme (Twenty Twenty-One, Twenty Twenty, etc.).

If you don’t have access to the backend of WordPress, deactivate all of your plugins in your FTP client by navigating to wp-content, and renaming the Plugins folder to anything, such as “pluginsz”.

wordpress rename plugins folderPin

To deactivate your theme, open the Themes folder in wp-content folder, then rename your theme’s folder. This will activate the latest default WordPress theme in your installation by default.

If the issue goes away, activate each plugin and your theme one by one, and keep refreshing your site to see which one generates the error.

Fix #4: Configure correct file permissions

You can change your installation’s permissions via your FTP client. There should be a column labeled Permissions.

Files and folders should be set to the following permissions:

  • Directories (folders): 755, 750 or 775
  • Files: 644, 640 or 664
  • wp-config.php: 440 or 400
wordpress change file permissionsPin

Right click on a file or directory to change its permissions.

Fix #5: Reinstall WordPress core files

If all else fails, it doesn’t hurt to reinstall WordPress’ core folders just to rule out corrupted files.

This needs to be done via FTP. All you need to do is download the latest version of WordPress, and upload the wp-admin and wp-includes folders to your site’s root directory to overwrite your current copies of these folders.

If you’re running into permission issues when you attempt to upload these folders, set the permissions for each directory to 777 temporarily. Set them back to what they were originally (755, 750 or 775) as soon as you’re done as the 777 permission value creates a security risk in your installation.

Another method for reinstalling them would be with the Emergency Recovery Script from WPReset.com, a standalone script made for these exact situations. If there’s a corrupted core file, the script will detect it and automatically download the original version from the WP repository. That means that any file that has been modified, corrupted, or changed in any way will be spotted, and replaced with the original one with only a few clicks.

Fix #6: Contact your host

If you can’t pinpoint the error yourself, contact your host as the issue may be with their servers.

In this case, there’s nothing you can do as your host will need to resolve the issue on their end.

Wrapping it up

As you can see, there are a number of reasons for 500 internal server errors in WordPress. Hopefully one of the methods above will help you fix the error.

And, if you use a managed WordPress host – it is well worth contacting your host regardless.

Web hosts such as WPX Hosting and Kinsta provide excellent support and will often assist with these kinds of errors.