A 500 error means your website's own code or server hit a problem it could not handle, such as a PHP fatal error or running out of memory. A 502 means a server in front of your site (a proxy, load balancer or Cloudflare) got an invalid response from the server behind it, and a 504 means it got no response in time. All three are server-side problems, so visitors cannot fix them; the fix is in your site's code, hosting or server settings.
This guide is for business owners and managers whose site is showing one of these errors, or showed one recently. It explains what each code means, the common causes on WordPress and on servers, what you can safely check yourself, and when to stop and get help.
#What each error means
The codes are defined in the HTTP standard (RFC 9110), and MDN summarises them in plain terms.
| Code | Name | What it means | Where to look first |
|---|---|---|---|
| 500 | Internal Server Error | The server hit an unexpected condition and could not complete the request | The PHP or application error log |
| 502 | Bad Gateway | A gateway or proxy got an invalid response from the server behind it | Whether PHP-FPM or the app process is running |
| 503 | Service Unavailable | The server is temporarily unable to handle the request, often maintenance or overload | Host status, maintenance mode, resource limits |
| 504 | Gateway Timeout | A gateway or proxy got no response in time from the server behind it | Slow pages, long-running requests, timeouts |
The useful difference: with a 502, the server behind the proxy answered but the answer was broken or the connection dropped. With a 504, it never answered within the time allowed. MDN also notes that a 504 can come from the visitor's own network (VPN, firewall, DNS), so if only one person sees it, check from another connection first.
#Common causes on WordPress
On WordPress sites, most 500 errors trace back to one recent change.
- A PHP fatal error after an update. A plugin or theme update that does not work with your PHP version or another plugin. Since WordPress 5.2, this often shows as "There has been a critical error on this website" instead of a bare 500, and WordPress tries to email the site's admin address a recovery link. That email goes to the admin address stored in the database, which may be an old developer's.
- Memory exhausted. WordPress tries to give PHP 40 MB by default on a single site (64 MB on multisite), and many hosts allow more. Heavy page builders, large imports or WooCommerce reports can exceed the limit. The log shows "Allowed memory size exhausted".
- A broken
.htaccessfile on Apache servers, often after a security or cache plugin edited it. - A PHP version change by the host, where old code stops working on the new version.
- Wrong file permissions after a migration or manual upload.
If the error appeared straight after updating something, our guide to what to do when a WordPress update breaks your site walks through the rollback.
#Common causes on servers: PHP-FPM, timeouts and upstreams
On a VPS or cloud server, the website usually runs as a chain: Nginx or Apache receives the request and hands PHP work to PHP-FPM, a pool of PHP worker processes. The front server is the "gateway" and PHP-FPM, Node.js or another app is the "upstream".
- Visitor
- Cloudflare (optional)
- Nginx or Apache
- PHP-FPM workers
- Database
Each link can fail in its own way:
| Symptom | Likely cause | What a server admin checks |
|---|---|---|
| 502 on every page | PHP-FPM or the app process is stopped or crashed | Service status, recent restarts, out-of-memory kills |
| 502 or 504 only at busy times | All PHP workers busy; pm.max_children sets the most requests PHP-FPM serves at once | PHP-FPM log for "max_children reached", memory per worker |
| 504 on slow pages (reports, imports, exports) | Request takes longer than a timeout. Nginx's fastcgi_read_timeout defaults to 60 seconds, PHP's max_execution_time to 30 seconds | Slow queries, external API calls, raising the limit only for that page |
| 500 with "memory exhausted" | PHP memory limit too low, or a leak in one plugin | PHP error log, the plugin involved |
| Errors after a server move | Wrong socket path, PHP version or file ownership | Nginx and PHP-FPM config, permissions |
| Random errors with a full disk | Disk 100 percent full, so logs, sessions and the database cannot write | Disk usage, old backups and logs |
Raising timeouts and memory limits treats the symptom. If a page needs more than a minute to load, the real fix is usually a slow database query, a slow external service or a job that should run in the background.
#Cloudflare's 52x errors
If your site uses Cloudflare, you may see Cloudflare's own error page with a 52x code. These mean Cloudflare is working, but the connection between Cloudflare and your server failed.
| Code | Meaning | Common cause |
|---|---|---|
| 520 | The server returned an unknown error | The server sent an empty or invalid response, often a crash |
| 521 | The web server is down | Web server stopped, or a firewall blocking Cloudflare's IP addresses |
| 522 | Connection timed out | Firewall or rate limiting blocking Cloudflare (the most common cause, per Cloudflare), an overloaded server, or an old server IP in Cloudflare DNS |
| 523 | Origin cannot be reached | Network or DNS problem reaching the server |
| 524 | A timeout occurred | Server connected but took longer than 125 seconds to respond |
| 525 | SSL handshake failed | Server's SSL setup does not match what Cloudflare expects |
| 526 | Invalid SSL certificate | Full (strict) mode with an expired or wrong certificate on the server |
For 524 errors on long tasks like large exports, Cloudflare suggests moving those requests to a subdomain that is not proxied, or reworking them to run in the background. Our guide to setting up Cloudflare for a business website covers SSL modes, which cause most 525 and 526 errors.
#Safe first steps for a site owner
These steps are safe for a non-developer and do not risk making things worse. Do them in order.
- Note the details. The exact error text, the time (with time zone), which pages show it and whether it happens for everyone. Cloudflare asks for the same details when you contact your host.
- Check if it is just you. Try a phone on mobile data. If it works there, the problem may be your network.
- Check your host's status page for an outage in your data centre.
- Undo the last change. If you updated a plugin, theme or PHP version just before, roll it back, or restore the backup taken before the change.
- Read the error log. Your host's control panel usually has an error log. The line at the time of the error usually names the file and plugin involved.
- Disable the plugin it names, or if you cannot log in, rename that plugin's folder in the file manager. Do not delete plugin files.
- Ask your host to check resource limits, PHP workers and server logs, giving them the details from step 1.
Do not turn on WordPress debug display on a live site; WordPress's own handbook advises against using debug tools on production. If you need the log, write errors to a file instead of showing them on the page.
#When to get help
Get help straight away when the error affects your checkout, payments or logins, when it keeps coming back at busy times, when the error log points to the server rather than a plugin, when you run your own VPS, or when the site may have been hacked (unknown files in the log, strange redirects). Every hour of a 500 on a store is lost orders.
Our emergency WordPress fixes service handles critical errors, white screens and broken updates, usually starting with the logs and a safe rollback. For 502 and 504 errors on your own server, VPS and cloud server management covers PHP-FPM, Nginx, resource limits and Cloudflare. To catch the next one early, see our guides to website monitoring tools and a backup and disaster recovery plan.
Frequently asked questions
What is the difference between a 502 and a 504 error?
A 502 means the server behind the proxy sent an invalid response or the connection failed, while a 504 means it sent no response within the time limit. Both come from a gateway such as Nginx, a load balancer or Cloudflare.
Can a plugin cause a 500 error in WordPress?
Yes, a plugin or theme is the most common cause of 500 errors on WordPress, usually after an update. The error log names the file involved, and renaming that plugin's folder deactivates it.
How do I fix a 504 Gateway Timeout?
Find which page or task is slow and fix the cause, such as a slow database query, an external API or a heavy report. Raising the timeout only helps for genuine long tasks, and only for that page.
Is a 500 error my host's fault?
Sometimes, but usually not. Most 500 errors come from the site's own code, plugins or settings. Host-side causes include outages, resource limits and PHP version changes, so check the host's status page and ask them for the server log.
What does Cloudflare error 522 mean?
It means Cloudflare could not connect to your server in time. Cloudflare says the most common cause is a firewall or rate limit on the server blocking Cloudflare's IP addresses, followed by an overloaded server or an outdated server IP in DNS.
Sources
The facts in this article were checked against these pages, last reviewed 12 November 2026.
- 500 Internal Server Error, MDN Web Docsdeveloper.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/500
- 502 Bad Gateway, MDN Web Docsdeveloper.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/502
- 504 Gateway Timeout, MDN Web Docsdeveloper.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/504
- RFC 9110: HTTP Semantics, IETFrfc-editor.org/rfc/rfc9110.html
- Cloudflare 5xx errors, Cloudflare docsdevelopers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/
- Error 522, Cloudflare docsdevelopers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/error-522/
- Error 524, Cloudflare docsdevelopers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/error-524/
- Debugging in WordPress, WordPress Advanced Administration Handbookdeveloper.wordpress.org/advanced-administration/debug/debug-wordpress/
- Editing wp-config.php, WordPress Advanced Administration Handbookdeveloper.wordpress.org/advanced-administration/wordpress/wp-config/
- Fatal error recovery mode in 5.2, Make WordPress Coremake.wordpress.org/core/2019/04/16/fatal-error-recovery-mode-in-5-2/
- FPM configuration, PHP manualphp.net/manual/en/install.fpm.configuration.php
- Runtime configuration, PHP manualphp.net/manual/en/info.configuration.php
- ngx_http_fastcgi_module, nginx documentationnginx.org/en/docs/http/ngx_http_fastcgi_module.html




