Fix WordPress Issue “Internal Server Error”

500 Internal Server Error is one of the common and worst WordPress errors. I refer it as most frustrating WordPress error because like many other WordPress errors this error does not provide any specific information about the problem. It just says it is a server error but actually it is rarely a server error and usually when this error occurs the server is working fine.

You can confirm it yourself by checking other sites on the server or uploading a test file to execute to know whether the server is working fine which is most of the time is working fine.

Internal server error
Internal server error

Sometimes when you get this error you can access the administration area of your WordPress site but not front end. This proves this is not a server error because if it is a server error then your whole site should not work and it should display this error on every page of your site as the server powers your whole site.

Due to lack of specific information about the error we need to troubleshoot a lot to resolve this error by implementing various available solutions as described below. It consumes our lot of time as there is not any straightforward solution of it so we have to be patience.

If the error on your site gets resolved by implementing any one solution in first try then consider yourself lucky 🙂

What does “500 Internal Server Error” mean?

As described above the 500 Internal Server Error can literally mean anything and not tells us exactly what is the problem.

More specific it is a general HTTP status code 500 that tells us something has went wrong due to unknown issue on the Web server which is running the Web Site.

What causes to generate “500 Internal Server Error”?

The Internal Server Error is not WordPress specific error and anything running on the server can generate it but here we are focusing only on WordPress site specific internal server error.

In short there are various conditions that can cause to generate “500 Internal Server Error” as listed below.

Corrupt .htaccess File
PHP Version Incompatibility
Plugin / Theme code
WordPress Files and Folders Permissions
Plugin / Theme Incompatibility
Corrupt WordPress Core Files
Low Memory Allocated to PHP
Hosting Provider Specific Error

How you can resolve the “500 Internal Server Error” on your site?

To resolve the issue please try the solutions listed below from top to bottom, if one solution doesn’t work for you then try the next solution.

Wait and refresh the browser

Sometime it is temporary server issue so you don’t need to do anything to resolve it. Just wait for some time and refresh the browser to check whether the issue gone.

Clear browser cache and delete cookies

It happens rarely but sometime the issue is resolved but you are getting cached version of error page or getting error page due to cookies stored in browser. To tackle such condition just test your site on another browser or try clearing your browser cache and deleting cookies then restart the browser.

Enable debugging and logging

The internal server error does not provide any specific information about the source of the issue that generated this error so if you enable WordPress debugging, PHP error logging and server logging as described on the following pages then you may get some more specific information about the issue that will help you to resolve it.

https://codex.wordpress.org/Debugging_in_WordPress
http://php.net/manual/en/errorfunc.configuration.php#ini.error-reporting
https://in.godaddy.com/help/working-with-error-logs-1197
http://support.hostgator.com/articles/can-i-access-my-apache-log-files

Restore the site backup

If you have very recent working backup of your site then try restoring it which will overwrite the files and remove newly added files which was causing the issue. We strongly recommend to do this thing only and only if you have very latest backup of your site and you have nothing to lose than the files which caused the issue.

Check corrupt .htaccess file

Using any remote file manager like FTP, cPanel, SSH etc. connect to your website hosting server and just rename your WordPress site .htaccess file to .htaccess-backup which you will find in the same directory where the wp-content directory is created as displayed in the following screenshot.

Rename .htaccess file
Rename .htaccess file

After renaming the .htaccess file if the issue gets resolved then it means it was causing by the corrupted .htaccess file which you just renamed so to create new .htaccess file go to the Permalink Settings of your site admin area Settings -> Permalink and save the settings.

On most system the .htaccess file is hidden so you won’t see it and you have to make it viewable as shown in the below screenshot.

Show hidden files using FTP
Show hidden files using FTP

Verify PHP version

The WordPress, plugins and themes require specific recent version of PHP so please make sure on your server you are using latest version of PHP and if not then upgrade it.

Check WordPress files and folders permissions

The WordPress files and folders should have proper permissions or it can generate the internal server error. The WordPress folders / directories should have either 755 or 750 permissions and files should have 644 or 640 permissions except wp-config.php that should have 440 or 400 permissions so other users on the same server can not read it.

Change file permissions using FTP
Change file permissions using FTP

You can get more information about WordPress files & folders permissions and how to set them on this page https://codex.wordpress.org/Changing_File_Permissions

Change file permissions using cPanel
Change file permissions using cPanel

Deactivate WordPress plugins and theme

The incorrect code in WordPress plugins and theme or incompatibility between them can cause to generate the internal server error so you can disable them to find out whether any of them is causing the error.

Deactivate plugins from admin area

Just go to the plugins section if you can access the WordPress site admin area and disable one plugin at a time and check whether the issue resolved, do this for every plugin one plugin at a time and if the issue resolved then it means the plugin which you just deactivated is causing this issue.

Change active theme from admin area

Even after disabling all plugins if the issue remains then try temporary changing the active theme to any unaltered WordPress default theme like Twenty Seventeen and if the issue resolved then it means the theme you were using caused this issue.

Deactivate plugins using remote file manager

If you can not access WordPress site admin area then you can not disable plugins and change theme from admin area but you can disable them from server using cPanel, FTP, SSH or any other remote file manager.

Using any remote file manager connect to your server and rename the plugins directory to plugins-disabled which you will find in the wp-content directory of your WordPress as displayed in the following screenshot.

Rename plugins directory using FTP
Rename plugins directory using FTP

After renaming plugins directory all plugins on your site will be disabled so just check whether you can access your site now and if you can then it means plugins are causing this issue.

In this case we need to find out which plugin is causing it so just visit the plugins page in the admin area of your site where you will see the error notifications as shown in the below screenshot which means the plugins are permanently disabled from admin area too.

Then rename the plugins-disabled directory back to plugins and enable plugins one by one from admin area to check which plugin is causing the issue. When enabling plugins one at a time the issue occurs again then it means the plugin you have activated just before the error is causing this issue.

Change active theme from database

Even after renaming plugins directory you can not access your site then it means this is not plugins issue then in this case we need to check whether it is theme issue. To check it connect to your server and replace the theme directory in the wp-content/themes folder with latest version of theme. If this doesn’t resolve the issue then try changing active theme to any unaltered WordPress default theme like Twenty Seventeen as described on this page http://www.inmotionhosting.com/support/edu/wordpress/change-theme-in-db

If the issue gets resolved after changing the active theme then it means the issue is generated by the theme that you were using on your site.

After finding out which plugin or theme is causing this issue you can contact the respective plugin or theme developer to resolve the issue in it but if none of the plugins or theme is causing it then you need to try further solutions listed below.

Re-upload WordPress core files

If it is not any plugin or theme issue then this can be an issue of WordPress core corrupted files so just download the same WordPress version from https://wordpress.org/download/release-archive/ that your site is using and extract it. Then using any remote file manager replace all your site files and directories with fresh one except wp-content folder as shown in the below screenshot.

Increase the PHP memory limit

When you get this error trying to upload any large file in your site or trying to login in the WordPress admin area then this probably caused by low amount of memory allocated to PHP than required.

You can resolve the issue in this case by increasing the memory allocated to PHP as described on the below pages.
https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP
https://docs.woocommerce.com/document/increasing-the-wordpress-memory-limit/

Contact your hosting provider

If nothing above helps to resolve the issue then this can be server side issue that you don’t have any control so please contact your hosting provider to resolve it.

How you can pre-plan and avoid the 500 Internal Server error on your site?

You can pre-plan to avoid the issue and recover it easily as described below.

Scan your site regularly

Viruses and hackers can damage your site files which sometime cause this issue. You can prevent this by scanning your site regularly for potential issue using any security scanners like following.

https://vaultpress.com/
https://www.wordfence.com/

Test plugins and themes before using

When you want to install / update plugins or themes first do it on your development site and if everything works fine then do the same on your production site. This way if the issue occurs then you can resolve it on your development site avoiding down time of your production site.

Take site backup regularly

Do take backup of your site regularly so that if the error occurs then you can restore the site easily without any hassle.

I hope you find the information provided here helpful but if you have any questions regarding fixing this issue or any other WordPress question then feel free to ask it in our free WordPress support forum where i would be glad to help you.

Also if you have resolved this issue any other way not listed above then please let us know about this in the comment so that it will be helpful for others.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.