How To Fix Internal Server Error In Woradpress [8 successful ways]

How To Fix Internal Server Error In Wordpress [8 successful ways]

However, WordPress uses the endless combination of themes and plugins to provide a better control and flexibility to the website owners. Nonetheless, you might have seen a lot of technical errors in WordPress one of them is “500 internal server error in WordPress or sometimes called generic server error”. This is annoying, and catch-all error that can make you panic.



When you encounter this issue you could see a few different messages. Some of them are here.

  1. HTTP 500 internal server error
  2. 500 server error
  3. 500 error
  4. Internal server error

Unfortunately, the error message does not provide any correction steps. There could be an issue either server error or PHP errors or maybe some others issues. So, it’s your business to figure out the root cause of this error.

Although, these errors have zero context. Means you have no trail to reach out to the exact solution. But, to fill out the context you can check out your server “error log” files to get a little bit information. It could be a helpful step to start with. If you don’t find any solution don’t worry, I will solve any roadblock you hit while fixing this server error permanently. I will also tell you why do you encounter “500 internal server error”, and how you can fix this error.

Also Read

WordPress login issue: 8 solutions to permanently fix the problem

Now let’s get started…

Why you encounter internal server error in WordPress

There could be a lot of reason behind this error. The common reasons are : –

  1. Mismatching between encoding and database collation
  2. Corrupted .htaccess file
  3. Due to wrong permission security mode in WordPress root files
  4. Failure of a plugin
  5. Outdated PHP version
  6. Due the failure of WP- admin & WP-includes files [WordPress core files]
  7. Limited PHP memory

Now, you know the root causes of the server error. First, take a simple step and try to fix the error. If your problem gets shorted, it means that was the reason causing the server error.

Before going further, take a backup of your WordPress site and also allow debugging. You can take the backup of your site from Cpanel and for debugging, open wp_config.php” file and look for a single line of code define(“WP_DEBUG”, false); and replace “false” with “true”.

If you don’t find the following code then you can create it by yourself. Place define(“WP_DEBUG”, true); code at starting of your WP_config.php. Once created, try to reload your site if it works then you would get a different error message through which you could easily investigate the error and make it fix. Otherwise, keep on reading. [Don’t forget to turn off the debugging once you get the solution. Replace “true” with “false”]

Now, let me first tell you what is an internal server error?

What is 500 internal server error in WordPress?

Each and every HTTP request made by the browser to the web application running on IIS (internet information service) returns the status of the response. If browser’s HTTP request unable to collect the data from the server then this causes an HTTP server error. This could happen due to any programming issue or HTTP request issue or any other given above.

How to fix internal server error in WordPress

There are several ways to solve this error. But it mainly caused by corrupt .htaccess file. So, I suggest you first check out the .htaccess file to ensure whether it is correct. If you don’t know how to do that then you can go to the 2nd step.

#1. Mismatching between encoding and database collation

WordPress uses English as a default language. But sometimes you might notice that many websites use different languages.

If your site is multilingual then it could cause the internal server error because of mismatching between encoding and WordPress database collation.

For example, take my website, here I am using only English language and my database collation correctly matches the encoding:- see below

ENCODING:- define(‘DB_CHARSET’, ‘utf8mb4’);  [You can find this code in wp_config.php file]

 DATABASE COLLATION: – utf8_unicode_ci    [you can find this code in WordPress database]

You can check it by going into the wp_config.php and investigate whether it is same. For English language, set the WP collation “utf8_unicode_ci”. (*Do not try to make any changes without having database knowledge)   

But how to match encoding with WordPress database collation.  Let’s see how you can do it.

First of all, login to cPanel and go to public_html > wp_config.php file. Click to download the wp_config.php file.

mismatching between encoding and wordpress database collation

After downloading, go to PhpMyAdmin panel and head over to WordPress database and then click the operations. Here you will see collation setting. On the behalf of above discussion make changes.

 how to match wordpress database collation with encoding

 

Once you have done, you can try. If error gets fixed that means it was the reason causing 500 HTTP server error.

 

#2. Corrupted .htaccess file

Removing the corrupted .htaccess file could fix this issue by 90%. So, I recommend you to take this step very first. Because it does not require any coding skills.

The .htaccess file is a hidden file you can’t see it. Set the preferences to “show the hidden file” in public_html folder. This will allow all hidden files to show within public_html folder.

For that , go to the cpanel > public_html > settings > tick the option “show hidden files option.”

allow the hidden files in cpanel

As you access preferences you will find .htaccess file in the public_html folder. Once you find that file download a backup file in your computer and after that delete the existing file from the public_html folder.

Once done, try to open your website. If all fine it means your cpanel had a corrupt .htaccess file which causing the internal server error.

how to delete .htaccess file from cpanel

If it doesn’t work then you need to upload a fresh copy of the .htaccess file into your public_html folder. You can upload a new file by downloading a fresh & latest WordPress setup into your computer. After that, again check to ensure whether it was causing HTTP 500 server error.

#3. Incorrect “Mode security file permission” in cpanel

Basically, the function of the file permission security mode is to allow or disallow any person, server or bot to access your WP core files.

Normally, you don’t need to change the permission. When you upload any file on your server WordPress automatically assign a security permission which decides who can excess this file.

But many times you need to update this permission in order to allow the server to serve the files to the browser. This mostly happens to PHP or CGI files. Usually set the permission to 775. (never edit your CGI files in word format. Always open them with notepad)

Remember, never set the 777 permission because it is the most vulnerable state and a person can edit your web page in word format.

how to change the permission of the wordpress core files

You can try to change the permission of .htaccess file from 644 to 755. And check whether error gets fixed. If it works that means mode security was causing the server error. [Do not set the permission other than 644 or 755. If you find any different permission code that means it may have wrong permission and maybe causing 500 internal server error. ]

 

#4. Failure of a plugin

Are you still getting server error? Don’t worry it could be due to the failure of a plugin. Let’s see how you can deactivate WordPress plugin without login into WordPress dashboard.

First of all, switch to your hosting cPanel and click on file manager > public_html folder > wp-content > plugins. Right click on “plugins” folder and rename this to anything you like “plugins.deactivated”.

how to deactivate all plugins from Cpanel 1

deactivate all th plugins without going inside the wp admin area

You have successfully deactivated all your plugins without signing into WordPress admin area. Now, reload your site again if error gets fixed then it’s great. Now, you can log in to your WordPress admin area from here activate all the plugins again. You can either activate plugins one by one.

Note: Instead of deactivating all the plugins, deactivate the plugin that you have installed earlier.

 

#5. Outdated PHP version

Every time when WordPress updated, your PHP version should be at least 5.4 or higher. Most of the hosting provider companies come with a 5.4 default PHP version. But sometimes failure could occur due to the latest version of WordPress.

This could change the WordPress core file permission which causes the server error. So, it is always required to set suitable PHP version.

Now, learn how you to update old PHP version to the latest version. [for Hostgator]

Go to cpanel and click on software > PHP selector

How to update the php version in wordpress

Then select PHP 5.6 stable and click the “module_update” button.

update php version in wordpress site hosted under hostgator

It could be different for your hosting. In my case, 5.6 stable is suitable for my hosting server. So, according to your hosting select your suitable PHP version. Take a convenient suggestion from your hosting support before making any changes.

#6. Failure in WordPress core files (WP-admin & WP-includes)

WP-admin is very important because this allows a user to upload media, edit post & publish the post and so on. It means failure of this file restricted the user to interact with WordPress dashboard. So, uploading a fresh WP-admin file could resolve your 500 HTTP error. Similarly, re-upload the WP-include file and see the effect. It could also fix this issue.

 

#7. Limited PHP memory

Generally, limited PHP memory causes “allowed memory size exhausted error in WordPress”. As you know WordPress runs on PHP. To store and run all the PHP applications, the server allows a specific memory space to work properly. Exceed in PHP memory may stop the functioning of all the applications. Resulting, no response from the server. It could be the reason causing internal server error in WordPress.

Fortunately, WordPress allows the user to increase the PHP memory. So, let me tell you how to increase the PHP memory limit in WordPress.

There are several methods to resolve it. But using wp_config.php you can easily do it.

First of all, go to cPanel > file manager > public_html folder > wp_config.php file.

Download it into your computer and open it with notepad. Now, you need to include a simple line of code at the top.

how to lncrease PHP memory in wordpress

define( ‘WP_MEMORY_LIMIT’,  ‘256’);

Once you have done, re-upload the file in the public_html folder and try to reload your site. If all fine, your server error would be disappeared.

#8. Contact your hosting provider 

Definitely, contacting a hosting expert can easily locate your issue. So, I suggest you don’t go anywhere just open your hosting support panel and ask for help. They will definitely help you out.

My site is hosted by Hostgator. Luckily, they serve me well. So, I think this is the better way to figure out your issue.

Conclusion

By the way, It’s hard to locate the internal server error in WordPress. But I am sure if you try any of these methods you will surely locate the error and get the solution.

Which method has worked for you do let me know in comment section. If you have any query feel free to ask.

If you find this article helpful then do share on Facebook, Twitter, LinkedIn, Reddit and so on.

 

Save

Save

Save

Save

Save

Save

Save

Leave a Reply