Discuss your project

Glossary

PHP-FPM

PHP-FPM (FastCGI Process Manager) is PHP's primary FastCGI implementation. It runs pools of PHP processes to which a web server such as nginx or Apache forwards requests, and controls how many processes run under which user.

October 25, 2026PHP-FPMPHPWeb ServerOperations

In the past, PHP often ran as a module directly in the web server. Today, most installations separate the two: the web server handles connections, encryption, and static files, while PHP-FPM executes the PHP scripts. Communication uses the FastCGI protocol. The PHP manual describes FPM as a FastCGI implementation with features that are especially useful for heavily loaded websites.

How PHP-FPM works

A master process starts and monitors the worker processes. These are organized into pools. According to the PHP manual, each pool can run under its own user and group, listen on its own port or socket, and use its own php.ini values. This makes it possible to cleanly separate several websites on one server.

The web server forwards requests for PHP files to the appropriate pool, in nginx for example via the fastcgi_pass directive, in Apache via the mod_proxy_fcgi module. A free worker process executes the script and returns the response.

Further features according to the manual:

Process management

The pm setting determines how worker processes are created:

pm.max_children limits the number of requests processed concurrently and should match the available memory. With pm.max_requests, a process is restarted after a certain number of requests, which helps against memory leaks in libraries. request_terminate_timeout terminates requests that run too long.

Typical deployment scenarios

Security

Performance and operation

The number of processes results from the memory per process and the server's available memory. The status page and slowlog show whether requests are waiting or individual scripts are slowing things down. Together with OPcache, the pool configuration largely determines response times. Configuration changes require a reload of the service and should be made as planned changes.

How it differs

CGI starts a new process for every request, while FastCGI keeps processes permanently ready. PHP-FPM is PHP's process manager for FastCGI. The Apache module mod_php, by contrast, executes PHP directly in the web server process. The PHP command line (CLI) is independent of PHP-FPM and has its own settings.

Sources

Open the security header generator

EXPLORE THE GLOSSARY

Related Terms

More in Software Development

All Glossary Terms

YOUR NEXT STEP

What should
work better
next?

Tell us briefly what you have in mind. We will assess it and suggest a sensible next step.