WordPress 500 Internal Server Error

WordPress 500 Internal Server Error

We’ll show you, How to Fix “500 Internal Server Error” in WordPress . WordPress is a content management system (CMS) used by millions of people because it is free, customizable and easy to use. Although there is documentation for pretty much everything, many people find it difficult to manage their own sites. This may lead to their sites being down which is something nobody likes. One of the most common problems that occurs with WordPress is 500 Internal Server Error. In this guide we will show you few tips on how to fix 500 Internal Server Error and get your WordPress site up and running on your Linux VPS.

The first thing you need to do is to backup your WordPress site and MySQL database. No matter what is the root cause of the problem and how bad it is, it is always good to have a backup of the site. Once you create a backup of your WordPress site you can continue with the other steps.

1. Enable Debugging in WordPress

It is always good to start by debugging the problem. WordPress comes with specific debug systems designed to simplify the process. To enable debugging in WordPress, connect to your server via FTP/SFTP or SSH and edit the wp-config.php file. Add the following lines before the /* That’s all, stop editing! Happy blogging. */ line:

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);

WP_DEBUG is a PHP constant which is used to trigger the debug mode in WordPress while WP_DEBUG_LOG causes all errors to be saved in a log file called debug.log.

Save the configuration file and repeat the failed WordPress operation that caused the 500 Internal Server Error. Check for the debug.log log file inside the /wp-content/ directory for PHP errors, notices and warnings and if there are any you can try to fix them.

Ideally, you will want to have the following code in your wp-config.php file:

 // Enable WP_DEBUG mode
define( 'WP_DEBUG', true );

// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );

// Disable display of errors and warnings 
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define( 'SCRIPT_DEBUG', true );

2. Increase PHP Memory Limit in WordPress

One of the most common causes for the 500 Internal Server Error message is exhausting the PHP memory limit. This is usually set in the php.ini file. You can directly try to increase the memory_limit in php.ini and restart your Apache HTTP server / PHP-FPM service. The alternative is to add the following line in your wp-config.php file:

define('WP_MEMORY_LIMIT', '64M');

In case your application requires more memory due to multiple active plugins and heavy theme, you can set up a higher value here.

3. Create New .htaccess File

The .htaccess file can easily get corrupted due to bad plugin or manual changes. Log in to your server via FTP/SFTP or SSH and rename the file to .htaccess.BAK or .htaccess.CORRUPTED and create a new .htaccess file with the basic .htaccess settings.

4. Deactivate the Plugins in WordPress

If none of the previous solutions worked, you can try deactivating all your plugins in WordPress. If you have access to the WordPress dashboard you can navigate to the Plugins section and deactivate each plugin one by one. After each deactivation you can refresh your site and check if the problem is solved.

If you are unable to access the WordPress dashboard you can deactivate the plugins via FTP/SFTP or SSH. Log in to your server, navigate to your wp-content and rename the plugins directory to plugins.DEACTIVATED. Alternatively, you can navigate to the plugins directory and deactivate each plugin one by one. Do not forget to enable the plugins once you are done by renaming the plugins.DEACTIVATED directory back to plugins

Hopefully, some of these solutions helped you to fix the 500 Internal Server Error. If you still experience 500 Internal Server Error, it is recommended to contact your web hosting provider.

 

Original Article