Skip to content
AgileLogics
4 min read

The PHP Lifecycle & PHP-FPM

Prerequisites: Fibers & async basics

In production, PHP-FPM (FastCGI Process Manager) keeps a pool of worker processes ready, so a web server (Nginx) can hand off each request without starting PHP fresh every time — much faster than the simple model from How PHP Code Runs, Level 1.

Nginx (receives HTTP request)
    -> PHP-FPM worker (runs your script, request-scoped memory)
    -> response sent back through Nginx

Each request still gets a fresh, isolated memory space — unlike a long-running Node.js or Java process, a PHP script's variables don't persist between requests unless explicitly stored (session, cache, database), which is exactly why sessions exist at all.