How to Fix Internal Server Error

How to Fix Internal Server Error

Written by - Masood

August 2, 2017

Internal Server Error is one of the most common WordPress errors that can be a severe headache for you. Take a deep breath; we have some good news for you that it’s fixable. In this article, we will show you how to fix the internal server error in WordPress by compiling a list of all possible solutions.

Why do you get Internal Server Error in WordPress?

There are many reasons why the server raises a 500 Internal Server Error on your website. To fix this issue, it is necessary that one should identify the cause of the occurrence. Two common reasons for this error are the corrupt .htaccess file and PHP memory limit.
Let’s discuss how we can fix them.

Fix Internal Server Error through .htaccess File

The first thing you should do while troubleshooting the internal server error is to locate the corrupted .htaccess file. You can do so by renaming your main .htaccess file to something like .htaccess_old. To rename the .htaccess file, you will need to login to your website using FTP. Once you are in, the .htaccess file will be located in the same directory where you will see WordPress folders like wp-content, wp-admin, and wp-includes.

Once you have renamed the .htaccess file, try loading your website to see if the issue is resolved. If it did, then give yourself a pat on your back because you fixed the internal server error. Before moving on, make sure after logging into your WordPress Dashboard to go to Settings » Permalinks and click the save button. This will generate a new .htaccess file for you with proper rewrite rules to ensure that your post pages do not return a 404. If checking for the corrupt .htaccess file solution did not work for you, then you need to continue reading this article.

Increasing PHP Memory Limit in WordPress

Another way of fixing 500 Internal Server Error is by increasing the PHP Memory Limit. Your host and WordPress set the PHP memory limits by default. As soon as you observe a memory drop, the server automatically displays a 500 Internal Server Error. Simply increase the PHP memory limit in WordPress and check whether your website works fine or not. In this way, you can avoid 500 Internal Server errors occurring on your website.
Some of the most common ways of increasing PHP memory limit in WordPress is by adding the code in one of these files:

  • Functions.php File
  • .htaccess File
  • PHP.ini File
  • wp-Config.php File

Here is how you can add code to the files

Functions File

Simply access your root directory and find the functions.php file. Right-click on the ‘file’ and select ‘Download’. Open the file in your text editor and include this piece of code below in the opening PHP tag:

ini_set('upload_max_size' , '64M');
ini_set('post_max_size', '64M');
ini_set('max_execution_time', '300');


.htaccess File

You can also use the .htaccess file for increasing the PHP memory limit. Just make access to your root directory, and find the .htaccess file. Right-click on the ‘file’ and select ‘Download’. Now, open the file in your text editor and include this piece of code:

php_value upload_max_filesize 64M 
php_value post_max_size 64M


WP-Config File

You can also use your wp-config.php file for increasing the PHP memory limit. Just access your main root directory, and find the wp-config.php file. Right-click on the file and select Download. Open the file in your text editor and include this piece of code below in the opening PHP tag:

define('WP_MEMORY_LIMIT', '64M');
ini_set('post_max_size', '64M'); 
ini_set('upload_max_filesize', '64M');


PHP.ini File

You need to create a php.ini file and paste the below code into it. Upload php.ini file to the main root directory.

memory_limit = 64M
upload_max_filesize = 64M 
post_max_size = 64M 
file_uploads = On


If these two possible ways aren’t enough to resolve the 500 Internal Server Error, here are a few more ways to which you can avoid this Server Error to occur on your WordPress website.

Deactivate All Plugins

If you have access to the admin dashboard of your WordPress website, deactivate each plugin one by one. Refresh your website after each deactivation.

Then check your website again. If it starts functioning properly, then the internal server error must be due to the plugin. Now, you need to activate each plugin one by one and refresh your website after activation. The plugin which is causing a problem will soon be identified as it will result in a 500 Internal Server error.
Ideally, at this point, the issue has been settled. If not, move to the following step.

Fresh wp-admin & wp-includes

In this section, you need to download new wp-admin & wp-content folders and upload them to the live website host via FTP.  Make sure that you have taken a backup of your website before this step.

Contact Your Hosting Provider

If the problem continues even after the investigation of these common causes, then we advise you that you should contact your hosting provider. You can place a request to the technical support experts who can resolve your issue by going over your server settings.

You May Also Like…