How to Fix the 500 Internal Server Error in WordPress

In WordPress, the Internal Server Error or Error 500 is one of the most annoying errors because it does not return actual data about the underlying issue. It’s hard for beginners to eliminate it. There are many different reasons for Internal Server Errors.

Download WP STAGING to avoid this and other errors in the future. The WP STAGING plugin allows you to create a copy of your WordPress site in seconds. You can test new plugins, designs, and other updates in a secure environment on that staging site.

This error is a very dreaded kind of error. It seems to always come out at a very inopportune time. An error 500 means your site is offline completely and will not be available anymore, meaning you will start losing your customers. If your site is down for more than a few hours, Google might think there is something wrong with your site. This can lead to a loss of your site’s search engine rankings.

In this article, we will try to resolve this error by simple steps. But first, we need to know what the Internal Server Error is to fix it properly.

What is the Internal Server Error in WordPress?

The proper definition of Internal Server Error is unclear or undefined. An Internal Server Error or Error 500 is generic. It occurs when you visit a website, and your program sends a request over to the server where the site is hosted. The server receives the request, measures it, and sends back the resources (CSS, HTML, PHP, etc.) along with a header. If the status code is 200, then it means “Everything is Ok,” but if the status code is 500 (that’s why the name Error 500) means there is an error. That error is caused because some code went wrong on the website end.

The error may look like this:

Or it may look like this.

There are many different types of internal server errors with other status codes (500, 501, 501, 502, 503, etc.), but all these status codes are different but similar, so your site ends up not working expected.

Reason Behind the occurrence of Internal Server Error in WordPress

There are many reasons for this error. In WordPress, mostly, it occurs because of the following issues:

  • Outdated or broken Browser Cache
  • Low Memory Limit
  • Broken code in Plugins and Themes Functions
  • Corrupted files in WordPress core folders
  • Corrupted .htaccess file

How to fix Internal Server Error in WordPress

We have several steps to resolve this problem:

Reload the Page

When an Internal Server Error is displayed when you are opening a website, the easiest and first thing you should do is reload the page by pressing F5 if that is not successful, press ctrl + F5.

It may be the case that the server is essentially overloaded, and the site will return properly when you refresh it several times.

Delete the Browser Cache

Another good idea is to clear the browser cache. Clearing the browser cache may solve your problem. How to clear the cache on different browsers are given below:

  • Clear Cache In Google Chrome

To clear the Chrome cache, follow the following steps:

  • From the top of the Chrome window, click on the right side.
  • Then, select more tools and, from there, enter Clear browsing data.
  • From the Time range, select All Time.
  • Then, checkmark Cookies and other site data & Cached Images and Files.
  • Then, click the Clear Data button.

These steps can be performed on any chromium-based browser, i.e., Microsoft Edge, to clear the cache.

  • Clear the Cache in Firefox

Follow the following steps to clear the Firefox browser cache:

  • Firstly, open the menu bar and then select Options from the menu.
  • Select Privacy & Security from General
  • Then from the Cookies & Site Data section, click Clear Data.
  • From the dialogue box, remove the Cookies and Site Data checkmark.
  • Clear the data with Cached Web Content checkmark

  • Clear the Cache in Apple Safari

To clear the Safari browser cache, follow the following steps:

  • Select Setting from the home screen of Safari
  • Select Clear cookies & Data from the bottom of Safari’s Setting screen
  • Clear the cache from it
  • Clear the Cache in Microsoft Edge (Internet Explorer)

To clear the Internet Explorer cache, follow the following steps:

  • Firstly, Close all the windows of Internal Explorer.
  • Open a new one and then click on Tools Box.
  • Select Internet Options from the bottom
  • From the browsing history, click the Delete button.
  • Then, from Delete Browsing History, check-marked the temporary Internet files and website files and Cookies and Website Data and click on the Delete button and then Ok.
The following steps are more complex and affect the database/files on the WordPress website. To not cause any further damage, and if you still have access to the WordPress dashboard, create a staging site with WP STAGING and try to fix the error on the staging page instead of the production site.

 

You can create a staging site with WP STAGING.

Check Server Log Files

When your website throws a fatal error 500, you can tell your website to write more explicit error messages into a so-called log file for debugging purposes.

You can  enable the debug mode in your WordPress by opening the file wp-config.php and adding the following lines of code into it:

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

You can find the wp-config.php file in the root folder of your WordPress installation. You can use your web hosting control file manager or FTP to edit this file.

Check out that article to learn in detail how to activate the WordPress debug.log.

Depending upon what kind of web server your hosting provider uses, you can find the server error log file in the paths:

Apache server: /var/log/apache2/error.log

or

Nginx server: /var/log/nginx/error.log

To access these files, you will need to have full access to your hosting. You can use an FTP client and troubleshoot with the help of these files. Some web hosting control panels also have more easy access to these files.

Check .htaccess File

The 500 Internal Server Error may also happen due to some faulty code in the .htaccess file. That file is located in your WordPress site’s root directory and is essential to make your website running properly.

To troubleshoot your .htaccess, we need to disable the current one and create a new one.

First of all, use FTP or the file manager app in your hosting account to connect to your site.

You can find the .htaccess file beside the folders wp-admin, wp-includes, and wp-content.

  • Rename the file to .htaccess_backup to have a backup of the file if something goes wrong.
  • Please create a new file and name it.htaccess
  • Add the following lines of code into it:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

If the old .htaccess file were the reason for the error 500, this would fix the Internal Server Error for you.

Increase the Server Memory limit.

Sometimes the error 500 occurs because of the low Memory Limit of PHP in WordPress. To resolve this error, you may have to increase the memory limit. If your host is providing cPanel, you can increase your PHP memory limit from the dashboard user interface.

The steps are the following:

After opening the cPanel, click on the link that says, “Select PHP version.”

Then, click on “Switch to PHP Options.”

Then, click on “memory_limit” at the bottom and change its value to something higher, usually in the range of multiplied by 2, i.e., 256, 512 and save it.

Another way is to add the line below into your wp-config.php. You can use your hosting file manager software or an FTP client to edit that file.

Just add the following line on top of your wp-config.php file.

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

If a lack of memory was your issue, then this step will fix the Internal Server Error for you.

Check Installed Plugins and Themes

Sometimes, an Internal Server Error occurs due to recently installed WordPress themes or plugins. If you recently installed a plugin or theme and it broke your site there is a chance that you can deactivate that plugin to fix the error.

You can use the step below only if your WordPress admin dashboard under /wp-admin is still available!

  • Select all plugins, click on “Bulk-Actions” and on “deactivate” to deactivate all plugins.

  • Activate the Plugins one by one again and reload your site after each plugin activation.
  • If you see the error again, deactivate or remove that plugin, which causes the problem.

If your WordPress admin dashboard is not available you can disable a specific plugin by renaming its plugins folder to something else manually.

To do this, connect to your site via FTP.

For instance, if the woocommerce plugin is responsible for error 500 Internal Server Error you’ll need to rename the folder from
/wp-content/plugins/woocommerce to
/wp-content/plugins/woocommerce-disabled.

After that step, the woocommerce plugin will be disabled, and you can reaccess your website.

If you want to disable all plugins at all rename the folder wp-content/plugins to wp-content/plugins-tmp/ and reload your site.

Then all plugins will be disabled and your site should be reachable again.

After that step rename the folder wp-content/plugins-tmp back to the original name wp-content/plugins.

Repair WordPress Core Files

Sometimes, especially in older sites, WordPress files can be corrupt. If the WordPress core system is corrupt, you need to repair the core files by replacing them with the original ones.

One way is to go to wordpress.org and download the latest copy of WordPress from there.

  • Once downloading, unzip it.
  • After that, connect to your host using your FTP client or using the file manager within your hosting account.
  • Replace the entire folders /wp-admin and /wp-includes within your WordPress installation with the ones from the extracted zip file.
  • To do that, rename the current folders wp-admin and wp-includes to wp-admin-backup and wp-includes-backup.  This can be done with the hosting file manager or the FTP client.

  • Upload the new directories from the unzipped file to the same location as the old directories.

If your WordPress files were corrupted, this step will fix the 500 Internal Server Error for you.

Contact Your Hosting Provider

There are a few uncommon issues with Internal Server Errors in WordPress. At this point, you have to contact your host. Sometimes, these issues can be resolved by the hosting provider by looking at the file permissions and other settings.

If this still does not solve your issue, You may have to switch to another host that is more optimized to run your WordPress site.

Subscribe to our YouTube Channel for more WordPress video tutorials and connect with us on Twitter and Facebook.