How to Fix the 500 Internal Server Error on Your WordPress Website Without losing Data?

Hello Folks, Welcome to WPEra. The 500 Internal Server Error is the most frustrating error which makes you panic.  If you are encountered Internal Server Error in WordPress and you don’t know how to fix it, you come to right place. In This article I am going to show you how to fix the internal server error in WordPress.

500 Internal Server Error

What is Internal Server Error in WordPress?

When you encountered internal server error and tries to access your site, it will display the following error message.

The server encountered an internal error or misconfiguration and was unable to complete your request.

The internal server error occurs when something has gone wrong on the webserver and it doesn’t provide the information about the problem as the server doesn’t know where the error is happening actually. Internal server error is not always specific to WordPress and it can be caused by various reasons. In most of the cases the problem is not related to server failure.

What are the Reasons for internal server error in WordPress?

There are many causes for the internal server issue and most of them will occur in the root directory. The most common reasons for the internal server error in WordPress are corrupted .htaccess file, PHP memory limit, PHP Version Issues, Syntax issues in WordPress plugins and themes, Improper file permissions, Hosting Issues etc.

How to fix internal server error?

Fixing internal server error doesn’t have a straight forward solution. You need to do lot of troubleshooting to fix that. Here I am going to show you the step by step troubleshooting process to fix internal server error without losing data. This is the process I will follow whenever I got internal server error 500.

The steps to troubleshoot the internal server error are:

  1. Enable Debugging
  2. Check Your .htaccess File
  3. Increase Your PHP Memory Limit
  4. Switch To Default Theme
  5. Check Your Plugins
  6. Re-Upload WordPress Core Files
  7. PHP Version Issues
  8. Ask Your Hosting Provider
Note: It is always recommended to take complete backup of your WordPress website before making changes.

1. Enable Debugging:

Whenever you encountered any error in WordPress, it is recommended to work with debugging mode turned on. It helps in locating the actual cause of the error.

To enable WordPress Debugging, you need to edit wp-config.php file. The wp-config.php file will be located on the root folder of your site.

You can edit wp-config.php in following steps.

Step 1: Login to your hosting account cPanel.

Step 2: After logged into cPanel, look for File Manager and click on it. It will open file manager in new window.

Step 3: Navigate to your site’s root directory, and you will see a file labelled wp-config.php.

Step 4: Now right click on the wp-config.php and click on code editor.

Step 5: Now find the following line.

define(‘WP_DEBUG’, false);

Step 6: Replace the above line with the following code.

// Turn debugging on

define('WP_DEBUG', true);

// Tell WordPress to log everything to /wp-content/debug.log

define('WP_DEBUG_LOG', true);

// Turn off the display of error messages on your site

define('WP_DEBUG_DISPLAY', false);

Step 7: Now refresh your site and open the debug.log file to find where the issue actually happening. You can open this file through File Manager and is located in wp-content folder of your site. Based on the debug log, you may proceed to further steps to rectify that issue.

If WordPress debugging doesn’t help you in solving the issue, don’t turn off it until you resolve the issue.

2. Check Your .htaccess File

.htaccess file is a configuration file which contains rules and is used by the webserver which runs on Apache. The .htaccess file can be used to change the configuration of apache web server software functionality, rewriting URLs etc.

The corrupted .htaccess file may also throws 500 ISE.  To Fix corrupted .htaccess file on WordPress website, you need to follow the steps below.

Step 1: login to your hosting cPanel.

Step 2: Now look for File Manager and click on it. It will pop-up a window. Check the box for “Show hidden files.” Then click Submit button. This will open file manager in new window.

If you don’t see the pop-up, go for Legacy File Manager.

Step 3: Navigate to your sites root directory. Here you will see a file named .htaccess.

Step 4: Rename the .htaccess file to .htaccess-backup by right click on it select Rename.

Step 5: Now create a new .htaccess file by clicking New File in top menu.

Step 6:  Select your .htaccess file and right click on it and chose Edit. It will open your newly created blank .htaccess file in code editor.

Step 7: Paste the following rules in the editor and hit save button. This rules will be applicable for basic WordPress install.

# 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 you are using multisite with subfolders on WordPress 3.5 or later, use the following rules.

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} –d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

If you are using multisite with subdomain on WordPress 3.5 or later, use the following rules.

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} –d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

If you are using WordPress 3.4 or older, you can check out WordPress codex .htaccess page for the rules you have to use in .htaccess file.

Step 8: Refresh your site to see if this fixed the issue.

If it solves the issue, the problem is with your .htaccess file. So add other rules one by one from .htaccess-backup file and see which rule causing the error.

If it doesn’t fix the issue, delete newly created .htaccess file and rename .htaccess-backup to .htaccess.

3. Increase Your PHP Memory Limit

Internal Server Error 500 may also cause due to exhausting your PHP memory limit. By default, WordPress tries to increase the PHP limit when you are exceeding it but it can’t increase more than the limit which was placed by your host on the server.

Follow the below steps to increase the WordPress memory limit.

Step 1: Login to your hosting account cPanel.

Step 2: After logged into cPanel, look for File Manager and click on it. File Manager will open in new window.

Step 3: Now navigate to your site’s root directory, and look for file named wp-config.php.

Step 4: Now right click on the wp-config.php and click on code editor.

Step 5: Now find the following line in wp-config.php.

/* That's all, stop editing! Happy blogging. */

Step 6: Before that line add the following line of code and hit save button.

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

Step 7: Refresh your site to see if this fixed the issue.

If this fixes the issue, then you have fixed it temporarily. The reason why I am saying temporarily fixed is because you have a faulty bit of code which is exhausting your memory. If your host allowed you to monitor your resource usage, monitor it with turning on and turning off the plugins and switching between the themes. Then you will get an idea which Plugin / Theme eating your resources.

If increasing memory limit doesn’t fix the issue, follow next steps. 😛

4. Switch To Default Theme

Sometimes a faulty theme also causes 500 Internal Server Error. So I recommend troubleshooting by changing your theme to default WordPress theme.

If you have access to your sites admin area, you can change your WordPress theme from there.

If you don’t have access your WordPress admin area, you can switch default WordPress theme by using cPanel and phpMyAdmin.

Step 1: Login to your hosting accounts cPanel.

Step 2: Click on File Manager, it will open in new window.

Step 3: Navigate to your site root folder -> wp-content -> themes. Look for twentyseventeen folder.

if your themes folder contains the twentyseventeen folder, skip the next 3 steps.

if your themes folder doesn’t contain the twentyseventeen folder, it means twentyseventeen theme is not installed on your site. So you need to install it on your site.

Step 4: Download the twenty seventeen WordPress theme in zip format.

Step 5: Now click the Upload button in top menu of File Manager and pick the zip file which you have downloaded in previous step. This will upload twentyseventeen.zip file to your themes folder.

Step 6: Right click on the twentyseventeen.zip file and click extract. After extracting the file, delete twentyseventeen.zip file.

Step 7: Now Come back to cPanel and click on phpMyAdmin. This will redirect you to phpMyAdmin panel.

Step 8: Now click on your WordPress database which is associated with that domain. After clicking on the database name, the page reloads and displays all the tables in that database.

Step 9: Now select wp_optons table. This will allow you to browse the columns of the tables.

Step 10: Check the Show All option to display all the columns on one page.

Step 11: Edit the 2 rows whose option_name is template and stylesheet by clicking the pencil icon.

Step 12: change the option value of those two rows into twentyseventeen. That’s all, you are switched to your WordPress default theme.

Step 13: Refresh your site to see the status of the issue.

If the issue not solved, troubleshoot your plugins.

5. Check Your Plugins

Internal Server error can be caused due to faulty / incompatible plugins. If activating a plugin cause internal server error, then deactivate that plugin.

You can test your plugin by deactivating and activating the plugins. If you have access to your WordPress admin area, you can deactivate all the plugins and refresh your site to test the plugins.

If you don’t have access to WordPress admin of your site, follow the below steps.

Step 1: login to cPanel of your hosting account.

Step 2: Open File Manager and navigate to root directory of your site.

Step 3: Now double click on wp-content folder.

Step 4: Find the folder named plugins and rename it as plugins-deactivated by right clicking on it and choosing Rename option.

Now all plugins on your site are deactivated.

Step 5: Refresh your site to see weather issue was fixed or not.

Step 6: Now you need to rename the folder plugins-deactivated to plugins. By doing this doesn’t make the plugins active.

If the problem was solved means your plugins causing internal server error. Now your site is working fine and you will get access to WordPress Admin area too. If you visit the plugins in your dashboard, you will observe that all the plugins are deactivated.

If it doesn’t solve the error means, the error was not caused by the plugins. So skip checking your plugins individually.

Step 7: Now active one plugin at a time and refresh your site. Do this until you get the 500 Internal Server Error. So that you will know which plugin causing the error. you can activate or deactivate plugins from your WordPress dashboard coz its under your control.

Note: Sometimes Internal Server Error may be caused due to clash between 2 plugins. If the above step doesn’t work, try to test the site with combination of 2 active plugins at a time.

6. Re-Upload WordPress Core Files

Sometimes corrupted WordPress core file may throw internal server error. The chances for this are very low but it’s worth. To do this you need to replace some files and folders on your root directory.

If you don’t know how to update core files, just follow the below steps.

Step 1: Download the WordPress core files from here.

Step 2: Open the downloaded zip file and extract it. After extracting delete wp-content folder and wp-config-sample.php file to ensure important files won’t be overwritten.

Step 3: Now select all the remaining files and folders and right click on them and chose Add to archive. Name the archive as core-files.zip.

Step 4: Login to you cPanel dashboard and open File Manager.

Step 5: Navigate to Root directory of your site.

Step 6: Upload the recently created core-files.zip to that directory by click Upload button on the top menu and selecting the core-files.zip on your local computer.

Step 7: Now select the uploaded zip file and click Extract button on the top menu. Extracting them into the root folder replaces all your core files.

Step 8: Refresh your site to check the issue was solved or not.

If updating WordPress core files doesn’t solve your problem, go to next step of troubleshooting.

7. PHP Version Issues

Sometimes plugins and themes which you are using requires latest version of PHP. For example, a plugin on your site uses some PHP 7 functions which are not available in older version of PHP.

Before updating PHP version, investigate the PHP requirements of plugins and scripts on your site.

You can upgrade the recent version of PHP from the following steps.

Step 1: login to you Hosting account cPanel.
Step 2: Click on PHP Config which will found under programming group. It will open PHP Configuration setting in new tab.
Step 3: Chose the PHP version which you want to use and click SAVE CHANGES.

If don’t have access to PHP Configuration Setting, ask your hosting provider to update the PHP version for you.

8. Ask Your Hosting Provider

If none of the above fixes worked for you, then you need to contact your hosting provider. Ask them to check server logs to see where the issue is actually happening.

Note: You can do many of the above troubleshooting steps by using FTP Client like FileZilla instead of using File Manager.

Final Thoughts

The Internal Server Error 500 is the most frustrating error which will eat your valuable time. To resolve this issue, you need more patience and follow the troubleshooting steps carefully.

Hope this article helped you solving your Internal Server Error.

Did you fix the Internal Sever Error? Did any of the above Troubleshooting Steps Solved your issue? Let me know through your comments.

I am Divakara Ganesh, Heart and Soul of WPEra. I am a blogging addict, WordPress and Genesis Framework lover, web developer. Apart from blogging, I love to listen music and watch movies.

6 thoughts on “How to Fix the 500 Internal Server Error on Your WordPress Website Without losing Data?”

  1. I know this is bit techy, but one can follow this and understand how to fix such error manually. You have shared a very useful article here and I am sure every blogger is facing such issues when they deal with shared hosting.
    Thank you for your hard work, keep up doing the great work.

    Reply
      • Hi Divakara Ganesh,

        Would you be able to help me fix the sporadic 500 Internal Error on my site for a fee if I give you my cpanel login details? I don’t really have the time. Please respond to me via email if time permits – thanks.

        Reply
  2. Hi Divakara Ganesh,
    Thanks for sharing this useful information. This article really helps me a lot. I am facing the same problem and not get the solution but after reading your article I get the solution. Your step by step tutorial will help people solve these problems without having to any issues.
    Thank you Again.

    Reply

Leave a Comment