Sysadmin: PHP-FPM modular config

Sysadmin: PHP-FPM modular config 1
When you have multilple PHP-FPM pools configured on the server you usually store the configurations under /etc/php-fpm.d. When you have a lot of sites this directory starts looking pretty crowded.
Although when you look inside the typical PHP-FPM pool configuration file you can easily notice that there about only 4 lines that make a difference – everything else is absolutely identical.

Lets take a look at typical PHP-FPM pool configuration file, lets say /etc/php-fpm.d/site1.conf

As you can see only first 4 lines are distinguishing the rest is common for all the pools. So we can create configuration include file for the directives that are common for all pools

And place it as /etc/php-fpm.d/params-common and then explicitely include in our PHP-FPM pool config files as follows

The advantage of this approach is that you can quickly adjust various parameters that could affect sites performance with editing just single file.
Before setting this configuration into effect don’t forget to verify the configuration by running

Please follow and like us:

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">