The 500 internal server error is one of the most frustrating errors that occurs in WordPress. When this error occurs, it can appear on all the pages of your website. It occurs when there is an issue with the file system or server.
It is the root directory where the real problem occurs and this is where the WordPress files are. Another cause can be with the host’s server. If you have a WordPress site, this can be a frustrating problem since it requires varied troubleshooting. This guide is going to help simplify your task by taking you through simple steps to fix this error.
Most Common Causes
In most of the cases of 500 internal server error, the underlying cause could be one of the following two:
- The .htaccess file has been corrupted
- The PHP memory limit has been exceeded
The .htaccess file may go corrupt when a new plugin is installed or some other changes are made to your website.
Backup Your WP Site
Since the solutions to the 500 internal server error involve making changes to the WordPress site’s root directory, it is important that the first step you take a backup of your website and database.
1. Disable Plugins
The steps involved in disabling your site’s plugins are as follows:
- Log into your WP admin as administrator
- Click on ‘plugins’ on the left side
- Find the plugin that you suspect and click on ‘deactivate’
This step can also be used if you don’t know which plugin is causing the problem by disabling one plugin at a time and testing your website. Another method is to disable all the plugins in your site at once. This involves the following steps:
- Log into cPanel
- Navigate to ‘files’ on the home screen
- Click on ‘file manager’
- Located the directory where WordPress has been installed
- Open the directory called ‘wp-content’
- Right click on ‘plugins’ and click on ‘rename’
- This will open a dialog box
- Type the new name for the directory
- Click on ‘rename file’
This will disable all the plugins for your site. It is recommended to choose a new name that can be identified later.
If your website starts running normally now, you should start enabling one plugin at a time.
2. Corrupt .htaccess File
Corrupt .htaccess files are also a common cause of the WordPress 500 internal server error. This file is present in the root WP installation directory. If this is the underlying cause, you can fix the error by generating a new .htaccess file.
- Access WP installation directory through FTP or cPanel
- Find the .htaccess file (make sure the ‘show hidden files’ option is enabled because this file may also be hidden)
- Now rename the file to something new (something easily recognizable)
- Go to ‘settings’
- Go to ‘permalinks’
- Click on ‘save’
This will generate a new .htaccess file. If the internal server error no longer persists, you would know that the problem has been fixed.
3. Reverting back to Default Theme
If the above-mentioned steps don’t help you fix the 500 internal server error, you should consider reverting back to default theme.
When you switch to the default WP theme and if the problem no longer persists, it means that the theme was the culprit. If the trouble is with the theme, make sure to inform the theme’s author. Sometimes the issue arises when an older version of software is being run. There is a great 000Webhost blog post that provides a simple guide on how to disable the theme and revert to the default them. It is the second option in this blog post.
4. Increase the Memory Limit
Another reason your website is having the 500 internal server error is because your website is using excess memory or the memory limit has been exceeded. When a site is using too much memory, it can mean that there is poorly coded plugin or theme at the root cause. One solution is to increase the memory limit. The simplest way to do so is to contact your host.
However, if you want to address the problem yourself, use the following steps:
- Find the php.ini file within wp-admin
- Create a blank text file as php.ini, if the file isn’t already there
- Look for the line that states ‘memory=xMB’ where x is a variable which can range from 32 to 512 (in the existing php.ini file)
- Double the variable x to increase the memory limit
- If you created a new php.ini file then you should select x as either 128 or 256
- Save the file and close it
A new php.ini file will have to be uploaded to the wp-admin folder through FTP.
5. PHP Version
It is very rare that earlier versions of PHP can cause the internal server error. But if the other methods don’t help in fixing this error, it is highly likely that this is the underlying cause. A simple way to fix the problem is to contact your host and get them to provide a new version. Find out which PHP version is being used by your host. It is best to choose the latest version so that your website works at its optimal levels.
6. Reinstalling WordPress
It rarely occurs, but the presence of corrupt files within the WP core can also cause the internal server error. It may be caused due to some error when the server tries to copy files. Uploading your WP core files again may help in fixing the error. Make sure to maintain a backup of WordPress and use an FTP client for uploading everything back, but the wp-content folder.
So follow the above-mentioned steps in fixing the 500 internal server error in your WordPress site. You should also enable debugging to prevent the issue from arising. Most of the time the error is caused due to just PHP memory limit or corrupt .htaccess file. Even if the cause is something else, you shouldn’t have any difficulty in fixing it.