How to Fix the Internal Server Error in WordPress

fix-for-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 error in WordPress and how they can get rid of it.

However, this error always troubles those who are new to the WordPress. There is no need to panic. It is one of the common WordPress errors users have to deal with, you cab 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 server or any other WordPress error; first of all stop worrying and dig for the cause of the error.

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

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 the WordPress is enabling debug mode. It is very helpful and handy in finding the actual cause of an error. All you need to do is add 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:


 

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

Corrupt .htaccess File

.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 error.

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 dont do that step the new htaccess file will not be generated and you will reveive 404 error on every other url.

From WordPress Editor (If you can access)
If the error is because of .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 404 error. For generating a new .htaccess file, go to Setting, select Permalinks and click on Save Changes button.

 

Broken Plugin

500 Internal Server Error in WordPress can occur due to corrupt WordPress plugins, How corrupt plugins? WordPress keep 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

If you are getting this error after activation of one plugin then deactivate that plugin and reload your website. Sometimes its 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 filemanager, then rename the folders of that particular plugin, for example if its jetpack then rename it something like to 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, Its working, right! Now change the name of the folder back to ‘plugins’. Now its , Reload your website after activating all plugins one by one.

This time when you activate of 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 its 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 back end code might have been changed.

How to Fix

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 same that like in plugins case.

Now, open the ‘themes’ folder and rename the folder containing all files associated with the activated theme, means rename the current 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

If your screen shows the line number and file name where the syntac 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 yopu 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 to have 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 error. 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

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 following line of code in the wp-config.php file,


Before editing the file Duplicate the wp-config.php and save it as wp-config.php.bak, its 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.

Summary
How To Fix The Internal Server Error In WordPress
Article Name
How To Fix The Internal Server Error In WordPress
Description
The 500 internal server error runs everywhere on your site when there’s a problem with the server of your site. Fix WordPress Error 500 now,
Author
Smart Active Blogger

Author: EDITORIAL STAFF

Editorial Staff at SmartActiveBlogger is a team of WordPress experts led by Niraj Kashyap. Page maintained by Niraj Kashyap.