HTTP error codes in the 5xx range — 500, 502, 503, 504 — mean something went wrong on the server side while trying to load a page. They're easy to confuse but each one means something different. This article explains what each code means, what usually causes it, and what you can do about it.

At a glance: 500 = your site's code crashed. 502 = the server couldn't talk to your site's application. 503 = the server is temporarily overloaded or a service is down. 504 = your site's application took too long to respond.

500 Internal Server Error

What it means: Your site's code crashed. The server tried to run your script and it returned an error.

Typical causes:

  • A bug in a PHP file, plugin, or theme.
  • A syntax error in .htaccess.
  • File permissions set too restrictively (scripts need to be readable by the web server).
  • PHP memory limit exhausted mid-request.
  • A PHP version mismatch (your code was written for a newer or older PHP than you're running).

What to do:

  1. Check the PHP error log. In cPanel → Errors (or MetricsErrors), you'll see the most recent error messages — usually with the exact file and line number that failed.
  2. For WordPress: enable debug logging by adding this to wp-config.php: define('WP_DEBUG', true); and define('WP_DEBUG_LOG', true);. Then reload the page and check wp-content/debug.log.
  3. If it started after a change: revert the change. If you just updated a plugin, deactivate it. If you just edited .htaccess, rename it and see if the error clears.
  4. If it came with a "memory exhausted" message: raise memory_limit via MultiPHP INI Editor.

502 Bad Gateway

What it means: The front-end web server couldn't get a valid response from the PHP process (or whatever is running your application).

Typical causes:

  • PHP-FPM (the process that runs PHP scripts) briefly restarted or was overwhelmed.
  • A PHP script ran out of memory and was killed by the system.
  • A server-side component is temporarily unavailable.
  • For VPS/dedicated clients: a custom application (Node.js, Python, proxy target) crashed or isn't running.

What to do:

  1. Refresh the page. Transient 502s often clear within seconds.
  2. If it keeps happening: look for recent errors in cPanel → Errors. A recurring 502 usually points to a specific script that's crashing or exhausting memory.
  3. If the site is slow or the error correlates with spikes in traffic: consider whether your plan has enough resources, or whether a plugin is generating more load than it should.
  4. Open a support ticket if the error persists and you can't find anything in your logs — this one often requires us to check server-side logs.

503 Service Unavailable

What it means: The server is reachable but temporarily refusing to handle the request — often because something is overloaded or deliberately disabled.

Typical causes:

  • Your site is in maintenance mode (common during WordPress updates — a file called .maintenance in your document root).
  • The server is under heavy load and has temporarily thrown up a gate.
  • A backup, scan, or other scheduled task is running and consuming resources.
  • For VPS/dedicated clients: Apache, PHP-FPM, or a custom service is stopped.

What to do:

  1. Check for a stuck maintenance mode file. If you recently updated WordPress and the site is still showing "Briefly unavailable for scheduled maintenance," an update was interrupted. Delete .maintenance from your site's root directory via cPanel's File Manager (enable "show hidden files" first).
  2. Wait 5–10 minutes and try again. Transient 503s from load spikes usually clear quickly.
  3. If it persists: open a ticket. A recurring 503 often points to a specific resource bottleneck we can identify from server logs.

504 Gateway Timeout

What it means: Your script started running but didn't finish in time. The front-end web server gave up waiting.

Typical causes:

  • A script that makes slow external API calls (a third-party service is down or slow to respond).
  • A large database query against a table that needs optimization or has grown too big.
  • A long-running import, export, or batch process initiated through the browser.
  • A plugin that does heavy work on every page load.

What to do:

  1. If the error is on a specific action (e.g. saving settings, running an import), the action may actually be completing in the background — reload the page after a couple of minutes and see.
  2. For long-running tasks: move them off the web request and into a cron job so they can run without a timeout ceiling.
  3. If a third-party integration is involved: check the status page of the service your site is calling. If they're slow or down, the fix is on their side.
  4. Raise max_execution_time in MultiPHP INI Editor if you legitimately need more time per request (though the better long-term fix is usually to move long tasks to cron).

Other 5xx codes you might see

  • 520, 521, 522, 524 — Cloudflare-specific errors. These mean Cloudflare couldn't reach or get a valid response from your server. Most commonly: a 521 when your origin server is down, or a 522 when it's slow. If you're using Cloudflare, check at cloudflarestatus.com and your own hosting server's status before assuming the problem is on their end.
  • 508 Resource Limit Is Reached — your account has hit a resource limit (CPU, memory, or entry processes). A single 508 is normal if your site had a traffic spike; repeated 508s mean the site genuinely needs more resources, whether from code optimization or a plan upgrade.

When to open a ticket

  • The error is constant (not intermittent) and you can't find anything in the PHP error log.
  • The error appeared suddenly without any change on your end.
  • You've checked logs, ruled out the obvious causes, and still don't know what's happening.

Include in the ticket: the exact error code, the URL or action that triggers it, whether it's constant or intermittent, anything you changed recently, and any error log output you've found.

Related articles

Still stuck? Open a support ticket

Дали Ви помогна овој одговор? 0 Корисниците го најдоа ова како корисно (0 Гласови)