How to Fix the 500 Internal Server Error in WordPress

·

The 500 internal server error runs on every page of your site when there’s a problem with the server or file system that’s powering your site. Those who are using WordPress for years have faced this problem and they know why are they getting 500 internal server errors in WordPress and how they can get rid of it.

However, this error always troubles those who are new to WordPress. There is no need to panic. It is one of the common WordPress errors users have to deal with, you can check our Advanced Guide to WordPress Error to find any kind of WordPress errors as it covers fixes for 99% of WordPress errors.

Just like other errors, it is also fixable but before if you should find its cause. Therefore, whenever you encounter 500 internal servers or any other WordPress error; first of all stop worrying and dig for the cause of the error.

So before jumping into debugging and fixing the problem, you should know what caused it. Here is a list of the most popular sections that create the internal server error in WordPress.

How to Fix the 500 Internal Server Error in WordPress - BloggerSprout

Click here to Download the ultimate guide to WordPress Errors and Solutions.

Disclosure: I may receive affiliate compensation for some of the links below at no cost to you if you decide to purchase a paid plan. You can read our affiliate disclosure in our privacy policy.

Causes of 500 Internal Server Error

  1. Corrupt .htaccess File
  2. Broken Plugin
  3. Broken Theme
  4. Corrupted Core Files
  5. Exhausted PHP Memory Limits

The first and foremost thing you should do whenever you encounter any error in WordPress enables debug mode. It is very helpful and handy in finding the actual cause of an error. All you need to do is add the following code at the bottom of wp-config.php, if you don’t know how to edit your WordPress files through ftp, then How to Edit WordPress Files through FTP should help:

error_reporting(E_ALL);
ini_set(‘display_error’,1);
define(‘WP_DEBUG’, true);

WordPress is not always responsible for Internal Server errors. Any other issue on the server-side can cause this error too. The objective of this post is to show WordPress users about fixing these issues in WordPress that cause 500 internal server errors without hiring a freelancer.  Let’s walk through these causes in detail and learn how to fix this error is caused due to WordPress.

Corrupt .htaccess File

The .htaccess file is a file configured at the directory level or the root level of WordPress. Apache-based servers use this file to control the directory in which it resides and also other files and subdirectories in that directory. A corrupted .htaccess file is also one of the causes of 500 internal server errors.

Create a New .htaccess File

From cPanel:

  1. In the Files section, click on the File Manager icon.
  2. Make sure “Show Hidden Files (dotfiles)” is checked.
  3. Click Go. The File Manager will open in a new tab or window.
  4. Open the folder where your WordPress in installed.
  5. Look for the .htaccess file in the list of files. You may need to scroll to find it.
  6. Right click on the .htaccess file >Rename it .htaccess.bak. Alternatively, you can click on the icon for the .htaccess file and then click on the Rename icon at the top of the page.

From the left-hand navigation menu in WordPress, ( if you can access WordPress admin, if not jump to step 10)

  1. Click on Settings > Permalinks.
  2. Review settings to be sure they are set up properly.
  3. Click the Save Settings button.
  4. Try reloading the site to see if the 500 Internal Server error has been resolved.
rename-htaccess-file

If after reloading the site, your site is working, you need to follow from step 7 again, if you don’t do that step the new .htaccess file will not be generated and you will receive a 404 errors on every other URL.

From WordPress Editor (If you can access)
If the error is because of the .htaccess file, rename it to .htaccess.bak. After you rename this file, reload your website and check if the error is resolved or not.

If resolved, then you have to generate a new .htaccess file otherwise your website will return a 404 error. For generating a new .htaccess file, go to Setting, select Permalinks, and click on the Save Changes button.

Broken Plugin

500 Internal Server Error in WordPress can occur due to corrupt WordPress plugins, How corrupt plugins? WordPress keeps rolling updates and sometimes plugins become incompatible with the WordPress version or even sometimes with the PHP version in your server.

Corrupt plugins are easy to find, only if you remember which plugin you activated or updated recently that triggered the internal server error.

How to Fix Internal Server Error due to plugin

If you are getting this error after activation of one plugin then deactivate that plugin and reload your website. Sometimes it can make your site inaccessible and you no longer can access the WordPress admin. In that case, use FTP or directly the file manager in cPanel.

If you have activated more than one plugin then deactivate all plugins. If you are using FTP or file manager, then rename the folders of that particular plugin, for example, if its jetpack then rename it something like jetpack-fix

Now, you can access your WordPress dashboard. If you can’t remember the plugin that you have activated or updated then,

There might be a case in which you cannot access the dashboard. Use FTP or File Manager in cPanel to navigate to the ‘plugins’ folder in the wp-content folder. Now rename the ‘plugins’ folder (say plugins-old). This will deactivate all plugins

This will deactivate all plugins all together, reload your WordPress dashboard, It’s working, right! Now change the name of the folder back to ‘plugins’. Now it’s Rock& Load, Reload your website after activating all plugins one by one.

This time when you activate the culprit plugin it will cause the error again. Now, you just need to rename or delete that particular plugin folder from your wp-content > plugins > culprit-plugin-folder using ftp or Cpanel.

Broken Theme

If this error message is still there on the screen and it’s not the .htaccess and the plugin, then you should definitely check the theme, the activated theme can be the troublemaker. The theme might be outdated or its backend code might have been changed.

How to Fix Internal Server Error due to theme

If you are lucky and you can access the WordPress admin area, switch to the default theme and if the admin area is not accessible then make use of an FTP client or cPanel.

The process is the same as in the case of the plugin.

Now, open the ‘themes’ folder and rename the folder containing all files associated with the activated theme, which means renaming the currently activated theme. This will deactivate the current theme and the default theme will be automatically activated. Reload the website. If you still see that error message, nothing is wrong with the theme.

Reload the website. If you still see that error message, nothing is wrong with the theme. Its something else

internal-server-error-wordpress-bad-theme

Corrupted Core Files

If you are editing the WordPress files to make some custom functions for your site and you forgot to add a curly brace, a comma, or a semi-colon, then you made a syntax error and your site may just show a blank screen, or show the file name and line number where you made the error or just 500 Internal server error.

How to Fix Internal Server Error due to corrupted files

If your screen shows the line number and file name where the syntax error is, then you just need to access the file through FTP or cPanel, correct and make changes to the code and everything is back again.

But if in case you get a blank screen or a message 500 internal server error, then use your FTP or file manager and open the error_log which is in your root folder of your WordPress.

Open the error_log, and scroll to the last few lines, you will find the line number and the file name that caused this error. Just revert the codes back or correct the syntax, and you are done.

If you are getting this error due to corrupted core files then you need to re-upload a fresh version of wp-admin and wp-includes folders from a new WordPress installation. As the wp-content folder remains untouched, you are not going to lose your data. But I always recommend having a backup before committing changes.

Exhausted PHP Memory Limits

WordPress requires a certain amount of memory to work which if it does not get, it might return 500 internal server errors. Plugins, scripts, and themes often occupy too much memory. The more you use cron or automation, the more memory it will consume

How to Fix Internal Server Error due to memory limits

In case this error is coming because of PHP memory limits, then you have to increase the memory limits. Increasing PHP memory limits is easy and it will hardly take a minute or two.

Use FTP or file manager to access your WordPress directory and all you need to do is to add the following line of code in the wp-config.php file,

define(‘WP_memory_Limit’,’64M’);

Before editing the file Duplicate the wp-config.php and save it as wp-config.php.bak, it’s always good to be on the safe side by backing up the config file. Save change the wp-config.php and reload your website.

Conclusion

500 Internal Server Error can be caused anywhere, After trying everything, if you are still getting this error then immediately get in touch with your service provider or hire a freelancer.

Share this post and feel free to write your reviews in the comments. If you have encountered this error and fixed it in some other way then share it with us as a guest post. It will be helpful for us and our readers.

Similar Posts

Leave a Reply

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