How to Fix 500 Internal Server Error on WordPress

wp server-error

If you’ve been on the Internet for a while, you’ve probably encountered an error when viewing the page with the text Internal Server Error with HTTP code 500. This error is quite common on various WordPress sites and can cause a minor panic attack for a beginner. Let’s take a look at the common causes and solutions to this nasty error.

What is the Server Error 500?

This is a very general error, it basically only says that something is wrong with the server. The causes are different and we will gradually discuss the most common ones. It can be reaching the limits of your server, an error in the .htaccess file and WordPress is often a bad plugin.

Corrupted .htaccess file

The first goal of your search should be an .htaccess file, which plays a fairly important role in rendering the site. First try to rename the file to .htaccess_simple, for example – the file is located in the main directory of the website (where you have folders like wp-admin, wp-content). After renaming it, the server will ignore it when displaying the site and you will see if the error has disappeared or if it is necessary to look for error elsewhere.

If the error is fixed, you must either find the problem directly in the file and delete it, or simply let WordPress create a new .htaccess. Just go to Settings -> Permalinks in the administration dashboard and save the settings again. This step will create a new  and perhaps error-free .htaccess file. Then just test to see if all the pages on your site are loading correctly.

Server limits

WordPress often runs out of memory to execute the script. This in turn causes a known error¬† 500. This is the PHP server memory_limit setting in the php.ini file. You don’t always have the ability to edit php.ini, especially if you have regular cheap web hosting, so you’ll need to find out why your memory needs suddenly increased (assuming the site worked normally in the past). However, this is good to know even if you manage to fix the problem by increasing the memory limit.

The culprit can be, for example, a poorly programmed wp plugin or even a template function. Try to remember what plugins or templates you recently installed and what else you changed on the site.

Tip: if you are using PHP 5.4 and higher, you must not have register_globals defined in the php.ini file – this parameter is no longer supported and may cause errors.

Deactivate All Plugins

If none of the previous procedures helped, you will need to try disabling all WordPress plugins. If you don’t even get into administration, you can try disabling plugins via FTP or via phpMyAdmin. If your site is up and running, it’s obvious that it was a faulty plugin – now you just need to find out which one. Gradually activate all plugins until you reach the one who is responsible for all the trouble.

Replacing WordPress Core Files

One of the last ways to get rid of error 500 is to reload all the basic WordPress files. Download the new WordPress installation (ideally the same version you are using) and overwrite the contents of the /wp-admin and /wp-includes directories on the server with those from the downloaded installation. This will overwrite the WordPress core files and any damaged files will be replaced with functional ones.

keep in touch with the host

If none of the suggested solutions work, try contacting your hosting provider, who will be able to search the server logs to determine the possible cause of the problem.