HireWebDeveloper.net

Problem × WordPress

WordPress 502 bad gateway error

the site is down and the message blames the server

Why it happens

A 502 means your reverse proxy (nginx, or the host’s load balancer) asked PHP for the page and PHP died or never answered. On WordPress that is nearly always:

PHP process crash. A plugin or theme hitting a fatal error hard enough to kill the worker: memory exhaustion (image processing, imports, backup plugins mid-run), infinite loops, or a PHP version incompatibility after a host-side upgrade.

Opcode cache corruption. OPcache holding stale bytecode after a deploy or update: pages break until the cache flushes.

Host-level timeouts. Long-running requests (imports, cron catch-up, backup restores) exceeding the proxy timeout: 502 on the heavy action, site fine otherwise.

Server resource exhaustion. On shared hosting, a traffic spike or a neighbour exhausting the pool makes PHP answers late and the proxy gives up.

Triage

Note the pattern: whole site, or only admin, or only one action? Whole site 502 is a PHP-version crash: if you can reach the host panel, check whether PHP was upgraded in the last day, and roll back one version to restore service. Only some pages: flush OPcache from the host panel, or deactivate the last plugin you updated (rename its folder via file manager if the admin is also down). Recurring 502s under load on shared hosting: the hosting tier is the answer, not a plugin.

When to bring us in

A live store or lead site sitting on a 502 is bleeding: that is WordPress emergency support, we take it, stabilise, then find the cause properly (error logs, plugin forensics, PHP version fit) so it stops recurring. If your site 502s every time traffic spikes, that is a hosting-architecture conversation, bring the numbers and we will size it honestly.