Swap Growing on Your Freebsd Server? Check Your php_fpm Settings - Step 2
Published: Jan 10, 2026
After tuning for swap space by reducing MySQL memory usage, the other area to look into would be php_fpm settings.
The settings are located here if you’re using a freebsd jail:
/usr/local/bastille/jails/<your jail name>/root/usr/local/etc/php-fpm.d/www.conf
Edit the file so your last five values are like this:
[www]
user = www
group = www
listen = /var/run/php-fpm.sock
listen.owner = www
listen.group = www
listen.mode = 0660
pm = dynamic
pm.max_children = 3
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 2
The meanings of the last five values are:
pm = dynamic # Worker count adjusts based on load
pm.max_children = 3 # Maximum 3 workers (caps memory usage), you might have a lot more by default
pm.start_servers = 1 # When the server starts, start with only one worker
pm.min_spare_servers = 1 # Keep at least 1 idle worker ready
pm.max_spare_servers = 22 # Do not create more than 2 idle workers
📢