; FPM pool configuration for the ANBT backend image (Phase 2).
; Loaded as php-fpm.d/zz-app.conf so it overrides www.conf.

[global]
; Send the master process log to stderr instead of a file inside the container.
error_log = /proc/self/fd/2
daemonize = no

[www]
user = www-data
group = www-data

listen = 9000
listen.owner = www-data
listen.group = www-data

; Consumed by /usr/local/bin/fpm-healthcheck. Not reachable through nginx
; because nginx only forwards index.php under public/.
ping.path = /ping
ping.response = pong

; Status page for observability (Phase 9 wires this into monitoring).
pm.status_path = /fpm-status

pm = dynamic
pm.max_children = 20
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 8
pm.max_requests = 500

; Worker stdout/stderr must reach the container log, undecorated so JSON log
; lines stay machine-parseable.
catch_workers_output = yes
decorate_workers_output = no
access.log = /proc/self/fd/2
access.format = "%R - %u %t \"%m %r\" %s %{mili}d ms %{kilo}M kB"

; Keep container environment variables (DB_HOST, JWT_SECRET, ...) visible to
; getenv() inside workers. Without this, FPM clears the environment and every
; getenv() call in Application::loadEnv returns false.
clear_env = no

; Defence in depth: only allow FPM to execute PHP files.
security.limit_extensions = .php
