WordPress

The WordPress 500 error

HTTP 500 is the server saying something interrupted the code. On its own it tells you nothing - the whole job is getting to the log.

3 min read

HTTP 500 is an Internal Server Error — the server's catch-all answer for "something went wrong and I cannot be more specific". The message is deliberately vague so it does not reveal configuration details. All the work, therefore, is in reaching the log that does have the details.

Find the server log

This is the first and most important step; everything else is guesswork. The error log usually lives in one of these places:

  • your hosting panel, under "Logs" or "Error log",
  • an error_log file in the site root or in public_html,
  • with SSH access: tail -n 50 /var/log/nginx/error.log, or the Apache equivalent.

Also switch on WordPress logging by adding this to wp-config.php:

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);

Output lands in wp-content/debug.log. One line from that file usually saves an hour of searching in the dark.

The .htaccess file

On Apache servers a damaged .htaccess is a very common cause. Rename it to .htaccess-old and check the site. If it comes back, go to Settings → Permalinks in WordPress and click Save — the file is regenerated correctly.

A note on Nginx. There .htaccess does nothing at all, so there is nothing to check. Rewrite rules live in the server configuration, which usually means involving your host.

Memory and execution time limits

If the error appears during one specific operation — an import, thumbnail generation, an update — limits are the usual suspect. In wp-config.php:

define('WP_MEMORY_LIMIT', '256M');
define('WP_MAX_MEMORY_LIMIT', '512M');

Execution time (max_execution_time) is set server-side, most often in the hosting panel. If an operation needs more than 300 seconds, raising the limit treats the symptom — splitting the operation into parts treats the cause.

Plugins and theme

The procedure matches the white screen: rename wp-content/plugins, check the site, then reintroduce plugins one at a time. With a 500 error, caching plugins and anything that writes rules into .htaccess are especially frequent offenders.

An incompatible PHP version

After a PHP version switch, older code can stop executing. The log will show a PHP Fatal error with a file name. Check what it points at — if it is an abandoned plugin, that is a signal to replace it rather than to roll PHP back.

File permissions

A rarer cause, but a real one after migrating to another server. Directories should be 755, files 644. Setting 777 is not a fix — it is an invitation to anyone looking for an easy target.

When the error appeared out of nowhere

If nobody changed anything and the site simply stopped working, consider two possibilities: your host changed something in the configuration, or somebody got into the site. In the second case, restoring the site settles nothing — the way in has to be found and closed.

Not working out?

If the problem stays, or you would rather not experiment on a live site, write to us and we will look at it. The diagnosis costs nothing.

WordPress support