How to Fix 500 Internal Server Error on WordPress

The 500 internal server error on WordPress is probably one of the worst you can get because your entire site is down. The 500 internal server errors are very often the consequence of an error in the PHP code.

But you never wrote a single line of code, so how could an error like that happen?

Every time you add a theme or plugin to your WordPress, you are actually adding lines of code. This can, among other things, crash your entire WordPress Website.

500 error code

In this article, I’ll explain you what is the 500 internal server error and explain you how to fix it!

500 internal server Error on WordPress: all what you should know about it

The 500 error is a server-side issue

The HyperText Transfer Protocol (HTTP) 500 Internal Server Error server error response code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.

This error response is a generic “catch-all” response. Usually, this indicates the server cannot find a better 5xx error code to response.

Source : Mozilla Dev Blog

The 500 internal serveur error belong to the 5xx status code family. This category of status Code refers to internal server errors. They occur when a server is not able to accomplish an apparently valid request. 

That means something has gone wrong on the web site’s server but the server could not be more specific on what the problem is about.


The other 5xx errors

The other server-side errors are:

  • the 502 Bad Gateway error indicating that one server received an invalid response from another server;
  • the 503 Service Unavailable error indicating that the site’s server is not available at the moment (and that’s why you should monitor your uptime on WordPress)
  • the 504 Gateway Timeout error appearing in situations where the link between two web servers is to slow.

The reasons why the 500 error can happen on WordPress

Request entity too large error

The 500 Internal Server Error is a server-side issue that can be triggered by:

  • A WordPress update;
  • A theme or plugin update/install;
  • A modification of your server configuration (php version, etc.);
  • If you exceed your PHP time or memory limit;

Troubleshooting the 500 Internal Server Error on WordPress

The 500 internal server error is a frustrating issue because it rarely have a clear cause. Troubleshooting it, might requires a lot of attempts. Here is what I always do when I want to fix the 500 Internal Server Error.

  1. Remove Plugins and themes
  2. Restore the .htaccess file
  3. Increase the PHP Memory limit

1. Manually Remove plugins and themes

It is likely that the 500 error you are encountering is a consequence of the last theme or plugin you installed or updated. So, the first thing to do is to remove them.

How to manually remove a plugin or theme if my website is down?

Easier said than done because your site is down and you can’t access the WordPress Admin Dashboard so how do you do that?

connecting to FTP client

You first need an FTP Client. I personally use Filezilla. The software if free and safe.

To use Filezilla and connect to your website, you will need to enter your FTP address, username, and password.

If you don’t know your credential, then check the first emails your hosting company sent you when you signed up. It usually contains your FTP username and password. If you don’t find it, reach out to your hosting support.

deleting useless plugin

Once you are connected, you need to go to /www/wp-content/plugins/ folder.

Then click right on your plugin, and click on delete. Erase one plugin, go back to your browser web, and open a private navigation window.

If this doesn’t work, go to the next step!

2. Restore a corrupted .htaccess file

Sometimes, plugins and themes can also corrupt your .htaccess file, causing the 500 Internal Server Error.

In order to restore your .htaccess file your need to access your WordPress Root directory with your FTP Client (see above).

editing .htaccess file

Then, download the file named .htaccess and open it with your favorite HTML editor.

Delete the contents of the file and copy/paste the code below instead.

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Save the file upload it, and reload your website to see if the 500 internal server error is fixed. If it is not, then navigate to the next step.

3. Increase your PHP Memory Limit

Another way of fixing the 500 internal server error is by increasing the PHP Memory Limit in WordPress.

To increase your PHP Memory Limit in WordPress you need to edit the function.php file by adding these 3 lines of code:

@ini_set(‘upload_max_size’ , ’64M’);
@ini_set(‘post_max_size’, ’64M’);
@ini_set(‘max_execution_time’, ‘300’);

Function.php is also located in WordPress Root Directory.

You can access and edit the file with your FTP client in the same way as the .htaccess file (see above).

Fixing the 500 Internal Server Error on WordPress: final thoughts

The 500 internal server error is really annoying because it affects every page of your website, so you need to fix it quickly. Yet, the 500 Server Error code is vague and not helping much.

If the tips I provided you in this article don’t work, reach out to your hosting provider ASAP.

Also, keep in mind that you are always better safe than sorry and one of the best not to trigger 500 internal server errors is to monitor WordPress PHP error logs and get rid of the plugins that are not strictly essential to your website!