I have some videos that go more in-depth on PHP-FPM, but here's an overview of where PHP-FPM configuration is and some options available to you.
First we'll check out where PHP-FPM listens. By default is listens using a Unix socket, which is how we configured PHP-FPM in our first video. We could optionally use a TCP socker (ip-address and port combination), but I choose not to.
listen = /run/php/php7.1-fpm.sock
We can use this to make sure our path in the Nginx configuration for
fastcgi_pass is accurate.
The other important part of configuring PHP-FPM is seeing how it manages processes. PHP-FPM spins up one or more processes for each web request. It can handle more than one web request at a time by spinning up more workers (child processes). Each worker can handle multiple web requests in serial.
Here are some setting we adjust in the video. Be sure to watch to see how I decide on the numbers used!
pm.max_children = 10 pm.start_servers = 4 pm.min_spare_servers = 2 pm.max_spare_servers = 4 pm.max_requests = 1000
We can over-ride php.ini values if we want:
; From: ;php_admin_value[memory_limit] = 32M ; To: php_admin_value[memory_limit] = 256M
Enable our Changes
Anytime we make a chanage to PHP-FPM, we need to restart or reload it to suck the changes in:
sudo service php7.1-fpm reload