2 php-fpm processes with the same version

unloco asked:

I would like to spawn two php-fpm processes (one with xdebug and one without) to make pages load faster

I intend to switch between php-fpm sockets based on the XDEBUG_SESSION cookie

Example code /etc/apache2/conf-available/php7.2-fpm.conf

<FilesMatch ".+\.ph(ar|p|tml)$">
  <If "%{HTTP_COOKIE} =~ /XDEBUG_SESSION=PHPSTORM/">
          SetHandler "proxy:fcgi://127.0.0.1:9000"
  </If>
  <Else>
          SetHandler "proxy:fcgi://127.0.0.1:9001"
  </Else>
</FilesMatch>

I know how to configure php-fpm /etc/php/7.2/fpm/pool.d/www.conf

listen = 127.0.0.1:9000

But I have no idea how to spawn multiple (or just two) php-fpm processes.
If there is a simpler way, please let me know.

My answer:


Make a second php-fpm pool with the changed settings that you want. You only have one which you named www. Choose a different name for the second one.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.