Apache, nginx and Caddy hand PHP to a PHP-FPM pool. One pool per site keeps sites apart: its own user, its own socket, its own limits. The kernel ships doc/eng-us/examples/web-servers/php-fpm-pool.conf for one installation. Velocity and FrankenPHP do not need a pool: they run PHP themselves.
Install it
- Copy the file to the pool folder of the PHP that serves the site: /etc/php-fpm.d/ on Red Hat style systems, /etc/php/8.x/fpm/pool.d/ on Debian and Ubuntu. On a hosting panel, set the values in the domain's PHP settings instead, because the panel writes the pool files.
- Replace example.com, the user and group (the owner of the installation's files) and listen.owner and listen.group (the web server's user: apache, www-data, nginx or caddy).
- Create the log folder and, for file sessions, a session folder of the site's own, owned by the site user with mode 700.
- Check and reload.
php-fpm -t # or the binary of that PHP version systemctl reload php-fpm # the master that serves the site
What matters for Exponential
- memory_limit at least 256M, more for large imports and image work.
- upload_max_filesize and post_max_size above your largest upload, and the web server's own limit too (client_max_body_size in nginx, maxAllowedContentLength in IIS).
- max_input_vars high enough for big class and role forms.
- php_admin_* values cannot be changed by a script; php_value ones can.
- With site.ini [Session] Handler empty (the default), PHP keeps sessions in files: give each site a folder of its own. With Handler=ezpSessionHandlerDB the database keeps them.
- OPcache on, with room for the kernel and the extensions. With revalidate_freq=2 a changed file is seen within two seconds; set 0 while developing, or keep it higher and reload the pool on every deploy.
- security.limit_extensions = .php, so only .php files run.
Reload the right master
After a change to a PHP class, operator or INI file, reload the PHP-FPM master that serves the site, then clear the caches that hold rendered output. On machines with several PHP versions it is often not the service called php-fpm. exp:velocity deploy finds it from the pool files ([DeploySettings] PhpFpmService=auto in velocity.ini) and runs the steps in the right order. See Running Exponential on Velocity.