PHP-FPM

acronym

web devprogramming

Kept in this browser · My desk

Stands for: PHP FastCGI Process Manager

PHP's FastCGI Process Manager: a master process and pools of PHP workers that a web server reaches over FastCGI.

It is how NGINX runs PHP, and what the PHP manual now recommends behind Apache httpd's mod_proxy_fcgi instead of mod_php. Each pool has its own user, listen address and settings, and each worker serves one request at a time, so pm.max_children is the pool's concurrency limit. The manual warns that php-fpm must not be reachable from an untrusted network.

The process manager runs in one of three modes: static, a fixed number of workers; dynamic, a range of idle spares under a ceiling; ondemand, workers started when requests arrive and stopped when idle. pm.max_requests recycles a worker after a number of requests, and the status page (pm.status_path) shows the listen queue, the active and idle workers and whether the ceiling was ever reached.

The listen directive takes a TCP address or a Unix socket. The manual's warning on it is blunt: an exposed FastCGI endpoint allows arbitrary code execution, because a client that can open a FastCGI connection controls the configuration used for the request. On the same host it prefers a Unix socket; over TCP it calls for listen.allowed_clients, which accepts any address when unset. It also says pools are not a security mechanism, since all of them share one OPcache instance.

Also known as: fpm, fastcgi process manager, php-fpm pool, pm.max_children, php-fpm.conf

← Back to P Back to the glossary