HTTP 500 or 503 on your site: causes and fixes

Print
  • 0

In short: a 500 error means the server could not run what the site asked of it, typically because of broken PHP code, an invalid rule in .htaccess or wrong file permissions. A 503 error means the site is temporarily unavailable, most often because it has run out of resources. Either way, the first clue is in the cPanel error log.

Telling them apart

  • 500 Internal Server Error shows up on every reload and often starts right after a change: a plugin update, an edit to .htaccess, a switch of PHP version.
  • 503 Service Unavailable comes and goes. It tends to appear during traffic spikes, while a scheduled task is running or when bots are crawling hard, and it clears once usage drops.
  • 524 only appears on sites behind Cloudflare: Cloudflare gave up waiting for the server because a script ran too long or the account was overloaded.

Step one for any of them: the error log

In cPanel open Metrics, then Errors. This lists the most recent web server errors for your account. PHP errors are also written to an error_log file in the site folder, which you can open in File Manager. Write down when the error happened and look for lines from the same minute. Reading those lines is covered in the error_log and faulty plugin guide.

Fixing a 500 error

  1. Plugin or theme. If the log points to a file under wp-content/plugins or wp-content/themes, switch that component off. You can do it without the WordPress dashboard, as shown in the error_log guide.
  2. The .htaccess file. Rename it for a moment, for example to .htaccess-old, and reload. If the page opens, one of its rules was the problem. WordPress can write a clean file for you: go to Settings, then Permalinks, and save. For other CMSs, use the .htaccess examples for popular CMSs.
  3. Permissions. Files normally need 644 and folders 755. A PHP file set to 777 can trigger a 500 error. Change permissions in File Manager by right-clicking and choosing Change Permissions.
  4. PHP version. An old plugin may break on a new PHP release, and a new plugin may need a newer one. Pick the version your CMS recommends, as described in PHP version selection.
  5. Roll back. If the error began after an update and you cannot pin it down, bring the site back to its earlier state with JetBackup 5.

Fixing a 503 error

  1. In cPanel open Metrics, then Resource Usage, and see whether the account hit a limit at the time of the error. Each limit is explained in the Resource Limit Is Reached article.
  2. Open Cron Jobs and look for duplicate tasks or tasks scheduled too often, such as every minute.
  3. Make sure bots are not swamping the site: how to spot and limit them.
  4. Wait a few minutes and reload. If the error keeps coming back after you have dealt with the causes, the site needs more resources; see how to change your plan.

When to contact us

If the log is empty, or you cannot tell whether the server or the site is at fault, open a ticket. Give the page address, the exact time of the error and the last thing you changed. With an exact time we can find the matching entries in the server logs much faster.

Related articles

Was this answer helpful?