Processes and memory
On Unix the master creates workers and supervises process exits. Each worker handles connections through its own event loop. $server->count selects processes per listener, not PHP threads.
State ownership
Section titled “State ownership”Arrays, static properties, containers and listeners belong to one process. Updating worker 1 does not update worker 2. Shared state requires an external database/store or an explicit inter-process protocol.
Create long-lived services when a worker starts. Clear request-scoped data after responding; release timers, subscriptions and connection references on close. Retaining a request also retains its associated data and uploads.
Process control
Section titled “Process control”The master maps SIGINT to normal stop, SIGTERM/SIGQUIT to graceful stop, SIGUSR1 to reload and SIGUSR2 to graceful reload. SIGHUP requests hot upgrade. Prefer CLI commands that account for platform and PID files.
Reload forks workers from the existing master rather than rerunning new master bootstrap code. Bootstrap/dependency changes need restart or a supported upgrade, with verification that old processes exit. Graceful shutdown remains timeout-bounded.
Windows uses a different startup runtime; Unix fork and signal behavior do not directly apply.