Troubleshooting 500 internal server error in WordPress

Internal server error, or sometimes it is called 500 internal server error, is probably one of the most confusing WordPress errors. This error occurs without any explicit cause, making it hard to address the issue, and can require a lot of troubleshooting from your end.

The Internal Server Error in WordPress occurs when there is a problem with the server or file system that is powering your site. The cause is most likely to be found in the root directory of the site, where you store your WordPress files.

At the same time, it can also be caused by a problem on your host’s server. Most of the time, this error is caused by a corrupted .htaccess file or an exhausted PHP memory limit.

However, there can be many other reasons behind this issue. Therefore you will need to dig a bit deeper to investigate the real cause. One of the best things to do when troubleshooting WordPress Internal Server Error is to trace back your steps.

Once you find the reason, then it is easy to solve the problem. However, safety is always first. So before you start proceeding with this tutorial, you have to backup your website files for a safety purpose in order to prevent file loss.

500 Internal server error due to plugin installation or update:

    If you find an error, after installing a new plugin or an update, then you can fix the problem by deactivating or removing the plugin. There are two ways to do it.
  • Fix the problem by deactivating your plugin via WordPress dashboard:

           If you are able to access your WordPress dashboard, then you can do these steps to deactivate it.

  1. Login to your WordPress dashboard

  2. Then click on plugins> installed plugins from the navigation menu

  3. After that deactivate the problematic plugin

  4. Once deactivating, refresh the website in the browser to check if the problem is fixed

  5. If the problem is not solved, then deactivate another plugin and repeat the process until all the plugins are deactivated

  6. Once you find the plugin responsible for this error, try removing and installing it again. You may also look for substitute plugins that perform the same function or contact the plugin community to check why the plugin is incompatible with your WordPress environment.

  • Fix the problem by deactivating your plugins via file manager or FTP:

There is a case that there may be an error causes your dashboard not to work. In that case, you have to deactivate the plugins via file manager which is located in your hosting control panel.

  1. Navigate to your WordPress root directory and enter the wp-content/plugins directory

  2. Now locate the problematic plugin and rename its directory to turn it off. If you want to remove the plugin, then you can simply delete the plugin directory.

  3. Once done, then refresh your website. In case still, the problem prolongs, proceed the process until all the plugins are deactivated.

  4. Then if you locate the plugin which caused the error, you may reinstall it, look for a substitute plugin, or contact the plugin creator to find out how to implement it on your WordPress website.

Error due to new theme installation or update:

If you find an error, after installing a new theme or an update, then you can fix the problem by changing your theme. There are two ways to do it.

  •  The problem can be fixed by changing the theme via WordPress dashboard:

            If you are able to access your WordPress dashboard, then do the following steps:

  1. Navigate to appearance>themes section

  2. Choose any other theme and then click activate to use it

  3. Once done, refresh your website and check if it works

  • The problem can be fixed by changing the theme via phpMyadmin:

  Alternatively, you may change your theme by editing your MYSQL database via phpMyadmin found in the hosting control panel. This can be done if your WordPress admin area doesn’t work. Then follow these steps:

  1. Locate your wp_option table and access it

    find the wp_options on phpmyadmin to update WordPress theme name

  2. Look for sections template and stylesheet(you will see this section on the second page)

    find template and stylesheet row in WP_options

  3. Now find out what themes you can use instead of your current one by navigating to wp-content/themes directory using file manager

    you will see list of themes on the theme directory

  4. Then copy the name of the theme that you want to use.

  5. Next change the template and stylesheet values in the database with your theme name.

    rename the theme to twentysixteen

Now you can reload your website in the browser to apply this new theme. If 500 internal server error is caused by your WordPress theme, then this problem may be solved.

  Fixing the corrupted .htaccess file:

One of the most important causes of this error in WordPress is corrupted .htaccess file. The .htaccess file could become corrupted while you made a change to your WordPress site or possibly by uploading a poorly written plugin to the site directory.

 In order to fix this, you will need to restore the .htaccess file. This file contains the rewrite rules that are necessary for your WordPress site to work properly.

  • If you have access to WordPress admin area:

  1. Login to your WordPress admin area

  2. Go to settings>permalinks>select your preferred option and save changes

    change permalink settings

  3. Refresh your site

  • If you don’t have access to WordPress admin area:

  1. Open your FTP client and access the root directory

  2. Right-click your .htaccess file and rename it to .htaccess_test

    rename the .htaccess file into .htaccess-test

  3. Create a new .htaccess file on your computer using code editor and paste the basic wp syntax from the WordPress Codex

    [php]# 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[/php]

  4. Upload the new file and refresh your site.

 Finally, if everything works, a corrupted .htaccess file was the problem and it is now fixed.

Fixing exhausted PHP memory limit:

Similar to corrupt .htaccess file, exhausting PHP memory limit is also a common issue that causes internal server error in WordPress. In order to fix this issue, you will need to increase the PHP memory limit.

 Your WordPress and host initially define PHP limits for uploading photos, images, videos and other files. However, the plugins and scripts exercised on your WordPress powered website need PHP memory in order to work properly on your site. Otherwise, those plugins and scripts need the assistance of PHP limits in order to load and function.

 So when this default limit is reached, your server will automatically showcase 500 internal server error. Basically, what you need to do in this error troubleshoot process is to increase PHP memory limit and easily get back to your WordPress websites usual functionality.

  • Increase the PHP memory limit:

  1. Open your FTP client and access the root directory

  2. Find the wp-config.php file and right click it and then select download

  3. Now open the file in text editor and add or update the following:

[php]
define(‘WP_MEMORY_LIMIT’, ‘128M’)
[/php]

  1. Save the file and re-upload it to your root directory

  2. Refresh your site

 Now if you find the problem is due to PHP memory limit, then this issue would be solved.

Fix the problem by changing the PHP version:

Certain WordPress plugins and scripts require a specific PHP version. In case if their requirements are not met, then 500 internal server error may occur. Then you must test whether this issue is related to your PHP version by changing it. This is performed by hosting control panel PHP configuration section.

 In case if you are not sure about what PHP version is required, then try all of them. Don’t forget to save your settings and refresh the website after each change. In case if this option doesn’t fix this error, then change your PHP version to the older one and proceed with the next method.

  • Try to enable the display of errors:

The reason to find this error is one of the toughest parts. If none of the above-mentioned options works, then you might need to go deeper by checking the errors. There are few ways to do it; by enabling error display, you may be able to find a specific part of your code that causes the issue.

 This can be done via PHP configuration section on your hosting control panel. Now set the display errors value as enabled and press save. Then you should refresh your website. The error in the code will be displayed as:

[php]
Parse error: syntax error, unexpected ‘ABSPATH’(T_STRING), expecting ‘,’ or ‘)’ in/home/u6944437/public_html/index.php on line 42
[/php]

 Another option is you may also create a separate error log file and generate entries to it with the help of .htaccess. Once if you locate the error, you can open the file mentioned in the error and look at the specified line for more information.

The problem can be fixed by using WordPress debugging:

WordPress itself has its own debugging system so that you can use it to troubleshoot the issue with your code. It will also help you to solve this error. To use this, you have to make few changes in the wp-config.php file first.

  1. Find the following code in your wp-config.php file

[php]
Define (‘WP_DEBUG’, false);
[/php]

  1. Remove it and place the following code:

// Enable WP_DEBUG mode

[php]Define (‘WP_DEBUG’, true);[/php]

// Enable debug logging to the /wp-content/debug.log.file

[php]Define (‘WP_DEBUG’, true);[/php]

// Disable display of error and warnings

[php]Define (‘WP_DEBUG_DISPLAY’, false);
@ini_set (‘display_errors’, 0);[/php]

// Use dev versions of core JS and CSS files (only needed if you are  modifying these core files)

[php]Define (‘SCRIPT_DEBUG’, true);[/php]

  1. Now refresh your website and open the file manager.

  2. Then navigate to the wp-content directory and look for a debug.log file. To see the generated entries, open the file in editing view

  3. Now you will be able to know the errors causing your WordPress website and you can solve them with the help of your developer, Google, StackOverflow or WordPress forums.

Re-uploading Corrupted core files:

Due to several reasons, your core WordPress installation may have an issue. This could be a file missing, changed or corrupted. If so, then you have to make sure that your core WordPress installation is the cause of this error in WordPress. Follow the steps to manually remove and reinstall WordPress core files.

  1. Get the latest WordPress zip file

  2. Unpack the zip file that you downloaded

  3. Deactivate plugins

  4. Delete the old wp-include and wp-admin directories on your web host

  5. Using FTP client or your shell access, upload the new wp-include and wp-admin directories to your web host, in place of the old deleted directories

  6. Upload the individual files from the new wp-content folder to your existing wp-content folder, overwriting existing files. But don’t delete your existing wp-content folder. Don’t delete any files or folders in your existing wp-content directory

  7. Upload all new files from the root directory of the new version to your existing WordPress root directory

You should replace all the old WordPress files with the new ones in the wp-include and wp-admin directories, sub-directories in the root directory. One more important thing is that be careful when you copy the wp-content directory because, you should copy only the files from inside this directory, rather than replacing the entire wp-content directory.

 Finally, you should have a look at the wp-config-sample.php file, to see if any new settings have been introduced that you might want to add to your own wp-config.php. Even if this troubleshooting doesn’t work then you have to move to the next approach.

  •   Try to restore a backup:

In case you have already backed up WordPress when it is in use, then restoring the backup is also a solution. Initially, remove all your WordPress site files. Then try to re-upload your content using Cpanel or FileZilla and re-check whether the website works.

  •   Ask help from the web host:

If all the above methods don’t fix this error in WordPress, then finally, you can contact your WordPress hosting provider to ask for genuine help. The reliability and quality of the support depending on the hosting service you are using.

 Before contacting the web hosting, you must try all the possible methods of fixing this error.

Final thoughts:

Overall, this error doesn’t affect the performance of your website but also frustrate you because of not having a clear cause or a solution. One needs to take the long mile to define the issue and do plenty of troubleshooting methods. In this article, we have listed the most common problems that cause the 500 internal server error in WordPress.

 If these methods don’t work, then there is a chance that your web host has to fix it. Hope you liked this article. If you have any queries or comments, please feel free to comment us. You can subscribe us on Facebook and Twitter.

6 thoughts on “Troubleshooting 500 internal server error in WordPress”

  1. I am a web developer. I like creating a unique website. I have gone through your article, it’s really a good information because people who work with WordPress have definitely come across this problem and your article will give an exact idea of troubleshooting this error. Keep updating posts like this. Thank you so much.

    Reply
  2. Hi
    Hope you are doing good. This is Daniel from the US. I am a web designer and am working with WordPress for past few years. Creating attractive and innovative websites is my passion as well as profession. I have worked on numerous projects and I have come across this internal server error. Not only me, almost all the WordPress users have come across this error. This error will be quite tricky as we may not know for what reason this error occurs because there are many reasons to occur. Your article is worth knowing about troubleshooting this 500 internal server error. It is really useful for both the beginners as well as the WordPress users. Thank you so much.

    Reply
  3. Thank you so much for this. I get the 500 error with every single page load and it’s infuriating!! I know it’s due to my iThemes plugin because if I deactivate it, the problem goes away (on both sites). I even have to disable the plugin just to create a post on my blog. Does anyone know if it will work after I create a new .htaccess file???

    Reply
  4. I just wanted to install a WordPress theme by uploading the zip in the dashboard panel but I got an error: “The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.”
    After that, my site has an error 502. What should I do now? How to access my panel? And how to install my WordPress theme?

    Reply
  5. Thanks
    Your article is really good. Its helpful for everyone. But I have a doubt. How, do you get fresh wp-admin and wp-includes folders?

    Reply

Leave a Comment