In plain English The part of the server that runs PHP code, the language WordPress and many sites are written in, and hands the finished page to the web server.
PHP-FPM (FastCGI Process Manager) is the service that runs PHP code for web serversWeb server The program that answers visitors’ browsers and sends them your website. Also used for the computer it runs on. More about Web server →. The web server, usually Nginx, receives a request for a PHP page and passes it to PHP-FPM, which runs the code and sends back the finished HTML. WordPress, Drupal, Laravel and most PHP software run this way.
Pools and workers
PHP-FPM keeps a pool of worker processes ready. Each worker handles one request at a time. Pool settings decide how many:
pm = dynamic
pm.max_children = 12
pm.start_servers = 3
pm.min_spare_servers = 2
pm.max_spare_servers = 5
pm.max_children is the important one: the most requests PHP can handle at once. Too low and visitors queue at busy times; too high and the server runs out of memory. Each site on a server can have its own pool, running as its own user, which keeps sites separated.
Where things are
| Debian and Ubuntu | AlmaLinux, Rocky, RHEL | |
|---|---|---|
| Service | php8.3-fpm (version in the name) | php-fpm |
| Pool files | /etc/php/8.3/fpm/pool.d/ | /etc/php-fpm.d/ |
| Socket | /run/php/php8.3-fpm.sock | /run/php-fpm/www.sock |
When it goes wrong
If PHP-FPM stops, or NginxNginx A fast, popular program that sends web pages to visitors and can pass requests on to apps behind it. More about Nginx → points at the wrong socket, visitors see 502 Bad Gateway. When every worker is busy, the log says server reached pm.max_children and visitors see slow pages or 503. Slow PHP leads to 504 Gateway Timeout.