How to Diagnose and Fix WordPress Internal Server Error (500)

What does 500 Internal Server Error in WordPress mean?

The 500 Internal Server Error problem in WordPress is a real nightmare for any blogger. The error is not critical but yet one of the most difficult to fix. That because it won’t tell you what caused the error to appear in the first place. In this tutorial, we will go through each possible causes and how to diagnose and fix your WordPress in no time.

Personally, I have spent countless nights in my early days with this issue. So I decided to write this in-depth guide to help you out. Please be sure you follow the instructions carefully since this problem is mostly code-related.

What causes 500 Internal Server Error in WordPress?

There are several common reasons on what causes the 500 error to appear in WordPress. I’ve categorized them into client-side and server-side causes.

Identify the category of your causes will make your problem easier to resolve.


Client-Side Causes

Client-Side causes usually related to your script (code). In a WordPress’s environment script includes plugins, themes, snippets, and WordPress core files itself.

Syntax Error

This is a Top of the list of what causes the 500 error. If the error occurs right after you have insert, modify or delete any code from any files, go back and undo those changes and re-upload them. The undo technique had helped me save hundreds of hours.

Corrupted .htaccess file

If your WordPress site is using the custom permalink setting, it might have written a corrupted .htaccess file which handles routing for your custom URL. Some plugins may interfere with WordPress permalink structure and cause the error as well. You can regenerate the .htaccess file by removing it from the root folder and go to Settings -> Permalinks and click Save again.

Plugin & Plugin Conflict

If you have recently downloaded and activated a plugin and your website goes down, it may happen because your new plugin is written poorly and conflicts with any of existing active plugin you currently have on your website.

Theme & Plugin Conflict

A poorly developed theme can also interfere with your active plugins and causes the 500 Internal Server Error to occur. If the error occurs after theme activation or upgrade, try switch back to a previous theme or downgrade them.


Server-Side Causes

Server-Side causes are often links with your web hosting configurations.

Server Permission

The most common of all the server-side causes. WordPress requires a correct permissions rules to read or write files in the directory. Double check your files and folders permissions to make sure WordPress have read and write access.

Request Timeout

A request timeout usually comes from poorly written code which causes the script to run forever in a loop and consumed all web server resources. Extending the resources may solve the problem for a period of time.

Server Timeout

If you are running a high traffic website, it may have consumed all the available resources and cause the server to timeout. However, if you’re website is not getting millions of views a day and running on ten dollars hosting, it might have something to do with your server configuration.

Exceeds Memory Limit

If you have dozens of plugins or running on high traffic without any caching plugin, WordPress can excessively drain your server memory (RAM) and CPU and result in 500 error.


Diagnose 500 Internal Server Error in WordPress

Diagnosing to find the root of your problem will pinpoint you where to start and save you a decent amount of time.

Remember, a good developer, don’t randomly fix things.

Don’t Panic

Being panic when your website is down is the worst thing you can do. Put yourself together and understand that panicking will only ruin your site and make it harder to fix.

Revert any changes

If you know exactly what have you done before the 500 Internal Server Error starts to appear, reverts your changes. Most of the time it happens after you have modified the code and upgrade the theme, plugin or WordPress version or even after you’ve installed and activated new plugin or theme. Give it a try by revert your action or hit undo. You may find it easier to fix than you have imagined.

Check Error Logs

However if revert any changes doesn’t make magic happens, you need to check your server error logs. Server errors are usually kept in your folder directory or control panel.

Enable Debug Mode

Add the following code to wp-config.php before /* That’s all, stop editing! Happy blogging. */ line

// Enable WordPress Debug Mode
define( 'WP_DEBUG', true );

// Logging debug messages to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );

// Display Errors and Warnings
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

/* That's all, stop editing! Happy blogging. */

How to Fix 500 Internal Server Error in WordPress

Backup your WordPress

Before we proceed every time, you must backup your WordPress backup by making a copy and download to your computer. For fixing the 500 internal server error you can only backup the whole WordPress and leave the database since it completely has nothing to do with the database. However, it would be better practice if you could backup both of them.

My Admin Area is Accessible Method

Normally when the admin area is still accessible while frontend of the website shown 500 error, it is always something to do with your active themes and plugins. This following instruction is a way to diagnose frontend problem step by step.

Step #1: Switch back to WordPress Default Themes

Go to Appearance -> Themes and click Activate Twenty Seventeen (If your WordPress doesn’t have one, download and install it). This way we can be sure that the error isn’t a result of any syntax errors or theme interfere with active plugins.

Step #2: Deactivate all Active Plugins

Navigate to Plugins page and select all plugins with checkboxes and choose Deactivate from a dropdown menu to deactivate all plugins at once. If the error disappears after all plugins deactivated, try to deactivate each plugin one by one to find the source of the problem.

Step #3: Reset .htaccess File

If you have deactivated all active plugins and the error doesn’t go away. Next step is to reset a .htaccess file to diagnose whether the error has anything to do with permalink or not. To reset the permalinks using the administrator panel follow these steps

  1. Go to Settings -> Permalinks
  2. Choose your permalinks configurations
  3. Click on Save Changes
Step #4: Re-Install WordPress

You can easily re-install WordPress to the latest version by using the Updates screen under Dashboard menu. This won’t delete any of your data, posts or pages. It will only re-install WordPress core files in case any of them are corrupted or missing.

If you have followed all of above steps and still doesn’t fixed your problem, move on and follow the steps below.

My Entire WordPress Website is Down (Only FTP Access)

Step #1: Check folder permissions

There is a slight chance that folder permissions are the issue of this problem unless you’re experiencing the problem since day one.

  1. Access to your WordPress root directory with your FTP Client
  2. Go through each folder and verify their permissions
    Folders permission should be 755 (0755)
    Files permission should be 644 (0644)
  3. Make sure every folder and every file permission are set as 755 and 644 accordingly.
Step #2: Switch back to WordPress Default Themes by Delete other Themes folder

You can easily force WordPress to use the default theme by deleting other themes in the folder.

  1. Use your FTP client and navigate to /wp-content/themes/
  2. Delete every themes folder except twentyseventeen.
  3. Refresh your website and it should set back to default theme.

Note: You can download everything inside themes folder to your computer and re-upload them in case it has nothing to do with your themes.

Step #3: Delete all plugins

If setting correct permissions and reverting to default theme doesn’t fix the problem, you can start to diagnose whether it comes from any plugins in your WordPress.

  1. Use your FTP client and navigate to /wp-content/plugins/
  2. Delete all plugins or deactivate them by renaming the plugin folder’s name.

Tips: If you don’t want to delete the plugin and install them again, renaming the plugin folder is also deactivate the plugin after you refresh your website.

Note: You can do the same for plugins by backup them before performing a delete task and re-upload them if it doesn’t solve the problem.

Step #4: Delete .htaccess File

You won’t be able to regenerate the .htaccess file just like you did in WordPress admin panel. You need to delete it and once your website is online, then you can regenerate new .htaccess file from the Settings -> Permalinks page.

  1. Use your FTP client and navigate to WordPress root directory
  2. Find .htaccess (Name starts with a dot is a hidden file. You might need to enable show hidden files option in your FTP Client) and Delete
  3. If it solves the problem, access your admin panel and go to Settings -> Permalinks
  4. Click on Save Changes to regenerate the .htaccess file again.
Step #5: Re-Install WordPress Core Files

If your problem still exists, you may need to replace WordPress core files with a fresh copy in case any of them are corrupted.

This process WILL NOT change or remove any of your existing data. It will only update your WordPress system files.

  1. Download a fresh copy of WordPress from WordPress.org
  2. Extract the zip file and copy wp-includes and wp-admin folder
  3. Use FTP Client and go to your WordPress root folder
  4. Upload and replace wp-includes and wp-admin with your new copy
Step #6: Increase Memory Limit

If your WordPress website isn’t accessible in both frontend and admin areas, try to increase the PHP memory limit by open the wp-config.php file in root directory.

Add the following code before line /* That’s all, stop editing! Happy blogging. */

define( 'WP_MEMORY_LIMIT', '256M' );
/* That's all, stop editing! Happy blogging. */

However, if the internal server error only occurs in the WordPress area you can follow these steps to only increase memory limit in admin areas. Why? Because we don’t want to give more resources to frontend since it’s already working with the current amount of resources.

To Increase Memory Limit Only in Admin area

  1. Create a new text file called php.ini
  2. Paste this text into the file and save
    memory=64MB
  3. Upload the php.ini file into your /wp-admin/ folder

Note: In some hosting company they have a restriction prevent users to increase the memory limit. This method might not always work.

IF All of the Above Methods Doesn’t Work

Sometimes you may not have full access and control to hosting configurations. The methods above are maximum on what you could do user-access level.

Ask for help

Contact your web hosting support. They will able to provide your more details what causing the issues by checking the log files on their side.

Keep in mind that this problem is easy to fix and may just happen because of a simple mistake.

We really hope this content has helped you get rid of the Internal Server Error. However, if you’re not able to fix it or somehow found another way around the problem, drop us a comment below. We are more than happy to help and add your solutions to this article.

 

Share this content!
  •  
  •  
  • 1
  •  
  •  
    1
    Share
  •  
    1
    Share
  •  
  •  
  • 1
  •