Troubleshooting1 min readUpdated

502 Bad Gateway and 504 Gateway Timeout

nginx could not get an answer from PHP. The causes, in order of how often we see them, and the fix for each.

A 502 means nginx got no answer from PHP; a 504 means PHP took too long. Either the PHP pool is down or busy, or one request is very slow.

CauseHow to tellFix
PHP pool downServices: the store's php8.x is not activeRestart it
All PHP workers busyPHP error log: server reached pm.max_children; often botsCheck Traffic and Protection; then tune workers.
A slow requestPHP slow requests log shows the same code each timeFix the slow code or raise max_execution_time for that one task
Out of memoryMemory graph at the top, swap highSee out of memory.
Database stuckmariadb not active, or long queriesRestart mariadb; ask us to check locks

504 on a long admin action (import, export, reindex)? Run it from the command line or the Actions tab, where there is no browser timeout.

Did this solve it? If not, tell us what you see and we look at your server.

Open a ticket

Still stuck? Ask a person.

Tickets go straight to the engineers who run ShopWhizzy servers. Tell us the store, what you see and when it started, and we take it from there.