PHP-FPM
Cheat sheet · https://pcornel.dk/topic.php?topic=6269
Answer
PHP-FPM (FastCGI Process Manager) runs PHP as a pool of worker processes that a web server (nginx, Apache, Caddy) talks to over FastCGI on a Unix socket or TCP port.
Remember
pm.max_children caps concurrent PHP requests — when it is reached, requests queue and the log says 'server reached pm.max_children'. 502 = web server could not talk to FPM (socket missing, permissions, FPM down); 504 = FPM accepted but answered too slowly. Never expose the FastCGI port publicly.
First checks
systemctl status php8.2-fpm(name varies by distro/version) — running, pools.php-fpm8.2 -t— configuration test.- Status page (
pm.status_path = /status) — active/idle processes, listen queue, max children reached, slow requests. grep -i 'max_children' /var/log/php8.2-fpm.log— pool exhaustion.- Web server error log: 'connect() to unix:/run/php/... failed' or 'upstream timed out'.
Verify in this order
web server location → fastcgi_pass (socket/TCP) → FPM pool listen queue → worker process (pm) → PHP script → response → web server
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6269