WordPress 502 After a PHP Upgrade: Tracing ‘Permission denied’ in the Nginx Log

Upgrading from PHP 8.2.31 to 8.3.36 produced a 502 because Nginx could not access the new PHP-FPM socket. Two Nginx installs made the fix harder to find.

About these notes: A maintenance log from my own InterServer VPS, not a generic support article. The fault occurred on 28 October 2026 and verification finished on 29 October 2026. PHP 8.3.36 is the version I upgraded to, not necessarily the current release when you read this. Paths and service names are specific to my server.

I upgraded PHP to keep the site maintained, and the WordPress admin immediately returned 502 Bad Gateway. The move was from PHP 8.2.31 to 8.3.36. The new version installed, extensions were present, PHP-FPM reported running — and the site still would not open. The eventual cause was that Nginx had no permission to connect to the PHP 8.3 socket. A second discovery made it much harder to find: this machine had two Nginx installations, and the configuration I edited in the panel was not the one serving the site.

PHP official homepage screenshot, shown only to identify the server-side language discussed; not a screenshot of
PHP official homepage screenshot, shown only to identify the server-side language discussed; not a screenshot of this site's backend or a test. Text and branding as displayed at capture time.

The order I should have followed

Symptom What to check first
Panel switched, WordPress still shows old PHP Whether the running Nginx and its site config are the ones you edited
Site down after switching Restore the previous PHP service and the backed-up config first
Log contains “Permission denied while connecting to upstream” Socket path, owning user/group, mode bits, and which user the Nginx worker runs as
Reload succeeded but permissions unchanged Whether you edited the config of the PHP-FPM service that is actually running

Step by step, including the wrong turns

I installed PHP 8.3.36 and added OPcache, fileinfo, Imagick and exif. The panel said it had switched, but WordPress still reported 8.2 — the first sign that two stacks were in play. After changing the real site config, the 502 appeared. I rolled back to PHP 8.2 first to get the site online, then investigated. That order matters: diagnose a broken site on a working site, not while visitors are seeing errors.

The Nginx error log contained the line that pointed somewhere useful: a “(13: Permission denied) while connecting to upstream” error. Nginx config syntax was fine and PHP 8.3 was running; the two simply could not talk. In other words, this was a socket permission problem, and plugin compatibility had not even entered the picture yet.

Socket PHP 8.2 PHP 8.3
Owning user www www
Owning group www-data www
Mode 0660 0600
Can Nginx’s www-data group connect? Yes No
Nginx official homepage screenshot, shown only to identify the web server discussed; not a screenshot of this site'
Nginx official homepage screenshot, shown only to identify the web server discussed; not a screenshot of this site's backend or a test. Text and branding as displayed at capture time.

I edited the PHP-FPM pool configuration to fix the listener ownership and mode, reloaded — and the permissions had not changed. That was the second Nginx/stack trap: the reload had succeeded on a service whose config was not the one taking effect. After identifying the live service, applying the change and switching versions again, WordPress finally ran on PHP 8.3.

What I took away

Restore service before investigating. Confirm which binary, which config file and which service unit are actually live before editing any of them. Read the upstream error line rather than guessing about plugins. And verify the result from WordPress itself, not from a panel’s green status indicator.

Frequently asked questions

What does “502 Bad Gateway” mean here?

Nginx could not get a valid response from its upstream — in this case it could not even connect to the PHP-FPM socket. It is a gateway/upstream error, not a WordPress plugin error message.

Is this a WordPress plugin incompatibility?

Not in this incident. The failure was at the socket permission layer, before plugin compatibility could be assessed.

Why did the config change appear to do nothing?

Because the edited file belonged to a different service than the one actually running. Check the active process and its config path before concluding a change failed.

A 502 checklist you can run in five minutes

The order below is a generic troubleshooting sequence for a PHP-FPM based WordPress site, not a new finding from the 28 October incident described above and not a claim about any other host. Unit names, socket paths and pool files differ between installations; use the versions that are actually active on your server.

Check Where to look What it rules out
Is PHP-FPM running systemctl status for the active PHP-FPM unit A service that never started.
Which socket is configured fastcgi_pass in the nginx site config A stale path left over from the previous PHP version.
Can nginx reach it nginx error.log for Permission denied Network versus filesystem permission problems.
Who owns the socket listen.owner / listen.group in the FPM pool A user mismatch after the upgrade.
Did the reload apply nginx -t then reload; confirm the live process Editing a config the running process never read.
Is WordPress at fault Temporarily point back to the previous PHP-FPM Plugin or extension incompatibility.

Why I now check the process before the config

My own wrong turn was editing a configuration file before confirming which process was live and which file that process had read. A 502 means nginx could not get a valid response upstream, so the useful questions are, in order: is the upstream alive, is nginx pointing at the right socket, can it open that socket, and has the running process loaded the change. Only after those pass is it worth suspecting WordPress itself. That habit also applies to the Redis service-versus-connection confusion on the same machine and to terminal mistakes after an SSH disconnect, where the symptom looked like a missing program but the real issue was which machine or process I was talking to.

For context on the machine, see what I pay for this VPS and what has broken on it and the separate timing sample, which is not related to this fault. If you are building a similar stack, the eight-stage setup guide shows where PHP-FPM and nginx fit, and What Is a VPS? covers the parts you are responsible for maintaining yourself. I keep this log narrow on purpose: it describes one upgrade on one server, not a general PHP version recommendation.

Where to read next

Redis Installed but WordPress Not Using It: Service, PING and Object Cache covers the Redis service-versus-connection confusion on the same machine, bt and redis-cli ‘command not found’ After an SSH Disconnect covers terminal mistakes during SSH sessions, and InterServer VPS for WordPress: What I Pay and What Broke covers the VPS these notes came from.