Running as a service
Run Server in the foreground under systemd or a container runtime. Do not combine start -d with an external supervisor: one process manager should own lifecycle.
Application build
Section titled “Application build”Install Composer dependencies from the lockfile before starting workers. Set configuration/state paths before Server::runAll(). The service user needs access to PID/log/status files; source and vendor should not require request-time writes.
systemd
Section titled “systemd”Example for /srv/my-app listening on an unprivileged port:
[Unit]Description=PHP applicationAfter=network.target
[Service]Type=simpleUser=www-dataGroup=www-dataWorkingDirectory=/srv/my-appExecStart=/usr/bin/php /srv/my-app/server.php startRestart=on-failureKillSignal=SIGTERMTimeoutStopSec=45StandardOutput=journalStandardError=journal
[Install]WantedBy=multi-user.targetCreate writable state directories separately. Align TimeoutStopSec with graceful shutdown and application deadlines; systemd may forcibly terminate the process after that interval.
Reverse-proxied HTTP
Section titled “Reverse-proxied HTTP”The proxy terminates HTTPS and forwards to an internal listener. WebSocket requires protocol upgrade; SSE requires disabled buffering and an appropriate read timeout. Trust forwarding headers only from proxy addresses configured in Request::$trustedProxies.
Updates
Section titled “Updates”Build dependencies and verify a health route in a separate release directory. Restart or use supported upgrade; reload has different semantics. Check the new response, worker PIDs and long-lived connection reconnects. Preserve the previous release for rollback.