Nodea — logo

PHP-FPM

PHP-FPM (FastCGI Process Manager) is an implementation of the FastCGI protocol for PHP that manages a pool of worker processes running your application code. Instead of embedding the interpreter inside the web server process, PHP-FPM runs as a separate background service and accepts requests over a TCP or Unix socket. It is now the standard way to run PHP on production servers.

How PHP-FPM works

PHP-FPM keeps one or more pools of child processes ready to serve a request the instant it arrives. The web server — usually Nginx or Apache — forwards each PHP request over FastCGI to a free worker, which executes the script and returns the output. Because workers persist between requests, the repeated cost of spinning up a fresh interpreter disappears.

The process manager mode is central to tuning: dynamic, static and ondemand decide how many workers stay warm and how the pool grows under load. Settings such as pm.max_children cap concurrent processes to protect the server from exhausting RAM, since each worker consumes up to its configured memory_limit. Combined with OPcache, PHP-FPM delivers very high throughput.

Practical application

PHP-FPM is the default way to serve PHP on modern VPS and dedicated servers and on most shared hosting. Separating the web server from PHP execution lets you scale each part independently: Nginx serves static assets and terminates HTTPS, while PHP-FPM handles nothing but application logic.

In practice, administrators create separate pools for different applications or users, isolating them by permissions and resource limits. A crash or traffic spike on one site then cannot starve the others. Because pool tuning maps directly to a site's traffic profile, it is one of the highest-impact optimizations on a busy PHP server, cutting response times while keeping memory usage predictable during peak hours.

Powiązane pojęcia

Najczęstsze pytania

How is PHP-FPM different from mod_php?

mod_php embeds the PHP interpreter directly inside every Apache worker, so each web process carries PHP's memory footprint even when serving a static file. PHP-FPM runs as a standalone service reached over FastCGI, letting the web server and PHP execution scale independently. It is the more efficient, and now standard, approach — especially with Nginx.