Introduction

The 500 Internal Server Error is one of the most common WordPress Errors. This article will show what steps to take to identify the cause of the error. In addition, we will provide an in-depth analysis of the most effective solutions.

By reading this tutorial, you will learn how to Fix the 500 Internal Server Error in WordPress.

500 internal server error wordpress tutorial

Prerequisites

  • FTP Client (such as FileZilla, CyberDuck, etc.)
  • Text Editor (such as Notepad++, Atom, etc.)

What is a 500 Internal Server Error?

The 500 Internal Server Error indicates that the server is unable to perform a particular function. It can be due to an issue on the server itself or a problem with a file crucial for running a website. The description is vague by design. The message is supposed to imply that an unexpected error occurred.

Backup Your WordPress Site

Backing up your website when planning to troubleshoot for the 500 Internal Server Error is always a good idea. It will be necessary to turn off certain functionalities of your website management system to determine which element is triggering the error.

The most common backup methods are:

  • Installing WordPress plugins that allow you to create backups
  • Using your Host interface to create a backup
  • Create a backup for WordPress site using FTP & phpMyAdmin

Note: Before attempting to troubleshoot the 500 Internal Server Error check if a caching plugin is active (like WP Supercache or another similar plugin).

You may not see your fix “work” until the cache has been rebuilt. If possible, turn off the caching plugin before attempting the fixes mentioned or allow a brief period between changes for the cache to rebuild.


Use an FTP Client to fix WordPress 500 Error

FTP clients are widely used as they provide access to files and folders of a website. The interface is user-friendly and very much in tune with a standard file explorer. This environment will allow you to easily upload, download, and manage files on your server. FileZilla is used in this example; however, any FTP client will work.

Once you log into your FTP client, locate your WordPress site core files. Open the public_html folder:

You are now in an excellent position to troubleshoot the most common issues that cause the 500 Internal Server Error:

  • Corrupted .htaccess file
  • PHP Memory Limit Issues
  • Audit Problematic Plugin(s)
  • Corrupted WordPress Core File

Check for Corrupt .htaccess File

The .htaccess file is used to configure website access rules. Updates and changes to server settings are frequent. These actions result in files getting altered or corrupted from time to time. Some files might even have been misconfigured initially.

To determine if the .htaccess file is corrupted we will rename it (to .htaccess_old for example). This simple action will disable the functions of the .htaccess file altogether.

 

Refresh your website. If it is accessible, it means that you have discovered the cause of the 500 Internal Server Error.

How to Fix a Corrupted WordPress .htaccess File

Create a New .htaccess File

To create a new .htaccess file in Wordpress:

  1. Navigate to your WordPress admin dashboard
  2. Go to Settings
  3. Then Permalinks.
  4. Click Save Changes.

Resaving your settings will automatically generate a new .htaccess file in your public_html folder. By using the FTP client, you will be able to see the new .htaccess file.

Additionally, you can delete the old .htaccess file – the same one you renamed earlier.


Note:Always check if file permissions are correct. Incorrect permissions will prevent your WordPress site from working correctly. The permissions on the .htaccess file should be 0644.


How to Increase the PHP Memory Limit in WordPress

If you are still getting the 500 Internal Server Error, you might have exhausted your PHP memory limit. You need to increase your PHP memory limit to determine if you are having an issue with a lack of memory.

Increase PHP Memory Limit in wp-config.php File

If your WordPress Admin is accessible, and the issue is with your website solely, we need to edit the wp-config.php file.

    1. Locate the wp-config.php file in the root folder of your website.
    2. Right click on the wp-config.php file and select download from the menu
    3. Open the file with Notepad++ or any other text editor.
    4. Locate the line /* That’s all, stop editing! Happy blogging. */ :
    5. Just above it type: define (‘WP_MEMORY_LIMIT’, ’64M’);
    6. Save the file
    7. Upload the edited wp-config.php file by overwriting the existing one in your root folder

Increase PHP Memory Limit in php.ini File

A lack of memory can even prevent you from accessing your WordPress Admin altogether. You can resolve the issue by adding a php.ini file to the wp-admin folder:

            1. Open a Text Editor (Notepad++ in this example).
            2. Type: memory=64MB

          1. Save File as php.ini
          2. upload the file to the wp-admin folder using your FTP client

          If this solved the immediate 500 Internal Server Error, excellent. However, this proves that the error is only a symptom. It means that something is rapidly draining your server’s resources. Analyze your logs in detail and have your hosting company investigate as well.

Audit WordPress Plugins

Another option is that the 500 Internal Server Error is caused by one of your WordPress plugins. Rather than testing each plugin piecemeal, there is a simple way of determining if a plugin is at fault in the first place.

The plugins folder is located within the wp-content folder. Rename the entire plugins folder using your FTP client. It will deactivate all your plugins at once. Renaming the folder will not edit nor delete the plugins themselves.

If you can access your website at this point, you have determined that one of the plugins is at fault. Rename the folder back to plugins.

Access your WordPress admin and activate each plugin, in turn. This action will allow you to pinpoint which plugin is causing the 500 Internal Server Error.

The error will return the moment the failing plugin is turned back on. Make sure that you refresh your page after every change you make.

By following these steps, you have successfully located and disabled the plugin responsible for the error.

Reinstall Corrupted Core WordPress Files

Alternatively, there might be an issue with your WordPress core files. It is a fast and easy fix. We need to replace two folders in your WordPress core using the FTP client:

  1. Go to WordPress.org and download the latest version of WordPress.
  2. Unzip and open the downloaded archive and copy the wp-admin and wp-includes folders
  3. Replace the identically named folders on your server with the freshly downloaded ones.
  4. Reload your website.

corrupted-wordpress-core-fix

Debugging WordPress

If none of these options worked, a slightly more complex solution might be in order. You can use the WordPress debugging tool to gather more information about the error.

Again, by using an FTP client and a text editor of your choice, you enter the following code into the wp-config.php file:

define( 'WP_DEBUG', true );

define( 'WP_DEBUG_DISPLAY', false );

define( 'WP_DEBUG_LOG', true );

debug-wordpress

Every time WordPress encounters a warning, error, or generates a notice, it will be written to your log with a time stamp.

You will find the info in the debug.log file.

The log contains a lot of information. It might be challenging to interpret the data unless you have extensive technical skills. If you have doubts, ask for professional advice before taking any measures based on the gathered data.

Conclusion

This article provided you with the best course of action to fix the 500 Internal Server Error in WordPress.

You now have a better understanding of how your system works. As a result, you will feel much more confident when encountering similar challenges in the future.