Independent review · contains affiliate links
⭐ We recommend BanaHosting — real SSD hosting from $4.95/mo, using our affiliate link See plans →
← Back to blog

500, 502, 503 and 504 Errors: What They Mean and How to Fix Them

Few things feel worse than opening your own site and finding a blank screen with a number on it. Worse still when it's a client who tells you first. The good news is that those numbers aren't random: each one is telling you fairly precisely where the chain broke. In this guide we walk through the four most frequent server errors, what each one means in plain language, and what to check in order so you can fix it without guessing.

First, understand the chain

When someone opens your page, the request passes through several hands: the browser asks DNS where your site lives, it reaches the web server (Apache, LiteSpeed or Nginx), that server hands the work to PHP, PHP queries the database, and out of all that the HTML goes back to the browser. Errors in the 500 family mean something failed on the server side, that is, somewhere along that chain. The number tells you where.

Error 500 — Internal Server Error

The most generic and the most common: the server tried to process the request, something blew up, and it had no better way to explain it. On PHP sites the cause is usually in your own code or configuration.

What to check, in order:

  • The error log. cPanel has an error viewer showing the real message with file and line number. This step saves you 80% of the work; don't skip it.
  • The .htaccess file. One badly written directive or a module that doesn't exist on the server produces an instant 500. Rename it temporarily and try again: if the site comes back, that was your problem.
  • A recently updated plugin or theme. If the error appeared right after an update, disable the plugin by renaming its folder over FTP or in the file manager.
  • PHP memory limit. A large site with too little memory allocated dies with a 500. Raising the limit from the PHP selector usually solves it.
  • File permissions. Folders at 755 and files at 644 is the standard; unusual permissions can make the server refuse to execute anything.

Error 502 — Bad Gateway

This one means something different: a server acting as a middleman asked another server for a response and got garbage, or nothing at all. On shared hosting, that typically means the web server asked PHP for a page and PHP died trying.

The most frequent causes are PHP processes crashing from lack of memory, a script hanging and being killed by the system, or an intermediate layer (a proxy, a CDN, an external firewall) failing to talk to your origin server. If you use a CDN or a protection service in front of your site, try reaching the server directly to rule out that the problem is in that layer rather than in your hosting.

A sporadic 502 lasting a few seconds is usually a momentary spike. A constant 502 is a configuration problem or an overloaded server, and that's when you talk to support.

Error 503 — Service Unavailable

The server is running but decides not to serve you right now. It's the most "deliberate" of the four: someone or something made the decision to reject the request.

Typical causes:

  • Maintenance mode. WordPress creates a temporary file during updates; if the update is interrupted halfway, the file stays behind and the site sits at 503 forever. Deleting it fixes things instantly.
  • Resource limit reached. Your account hit its ceiling on concurrent processes, CPU or memory, and the server rejects new requests until pressure drops. It's the clearest sign your plan has become too small.
  • A genuine traffic spike, from a campaign, a post that went viral, or a bot crawling your site at a thousand requests per minute.

If you see recurring 503s during your busiest hours, that's not a bug: that's your site asking for more resources.

Error 504 — Gateway Timeout

A cousin of the 502, with a different nuance: the middleman didn't get garbage, it simply got tired of waiting. Something took longer than allowed and the connection was cut.

The usual suspects are heavy database queries without indexes, bulk imports or exports, scheduled tasks doing too much work at once, and calls to external services that never answer. That last case is very common and very invisible: your site queries a third-party API, the API is down, and your entire page hangs waiting for a response that never arrives. Every external call should have a short maximum wait time.

Quick diagnosis: the table worth keeping handy

  • 500: something broke in your code or configuration → check the error log and .htaccess.
  • 502: the middleman received an invalid response → check PHP processes, memory, and external layers like your CDN.
  • 503: the server is refusing on purpose → check maintenance mode and your plan's resource limits.
  • 504: something took too long → check heavy queries, scheduled tasks, and external service calls.

Prevention: how to stop living with these errors

The three measures that most reduce how often these errors appear are surprisingly boring. The first is having automatic daily backups: they don't prevent the error, but they turn a catastrophe into a ten-minute inconvenience. The second is testing changes in a staging environment before touching production, because the vast majority of 500s appear right after updating something. The third is having resource headroom: a plan running at 95% capacity will throw 503s at the first traffic spike.

And there's a fourth that always gets underrated: technical support that answers fast and knows how to read a log. When the error is on the server side rather than in your code, being able to open a chat and get a useful answer in minutes is the difference between fixing it today and losing an entire day.

That's why, when someone asks which host I recommend for sleeping soundly, I say BanaHosting: 24/7 support via live chat, tickets and phone with responses in under 10 minutes, daily JetBackup copies on separate hardware, LiteSpeed that handles traffic spikes far better than traditional Apache, and a 99.9% uptime SLA in writing. With 19 years in the business and over 100,000 sites hosted, they've seen every error on this list thousands of times, and it shows when you message them at three in the morning.

Convinced you need better hosting?

These are the real BanaHosting plans, the provider we use and recommend.

See plans from $4.95/mo →

Hosting by profile

🏠 Hosting for individuals 💼 Hosting for professionals 🏢 Hosting for enterprises

Hosting where you are

🗺 Coverage by city Web hosting USA WordPress hosting New York Cheap web hosting

Other articles

🔍 Signs Your Site Was Hacked Before Google's Warning Shows Up 🆘 The First Five Minutes After Your Site Goes Down 🔑 Limited FTP Access: How to Bring a Developer In Without Risking Everything

Have you used BanaHosting?

Tell us in one line. Reviews are checked before publishing and help the next reader decide on real experience rather than advertising.

Leave my review
View plans & sign up