Doesn’t PHP-FPM Docker Image Care About Your Configuration Changes?

İbrahim Gündüz
2 min readAug 20, 2022

Problem:

I need to change the port configuration of www pool to TCP/8090. Although I modified and overridden www.conffile while building the image, php-fpm still starts with another configuration.

Investigation:

  • First, make sure that php-fpm is started with the expected configuration file by running php-fpm -tt inside the container.
  • If it’s the correct file, then open your php-fpm configuration file and check where it dynamically loads the pool configuration files from.
  • If it’s exactly the location where you copied the pool configuration file, then list all the available configuration files there and make sure any other file exists which is named alphabetically later than your configuration file. If there is a file that meets this condition and contains some configurations that you already modified in your file, php-fpm would consider the changes coming from the alphabetically last file.

Let’s see if there is anything that overrides each other in these files regarding port configuration.

Solution:

If you know what you do, you can clean up the folder and leave only your pool configuration or simply override the port configuration in zz-docker.conf while building your custom image instead of making the modification in www.conf.

That’s it. Thanks for reading.

Credits:

Cover image: https://blog.devsense.com/2022/multicontainer-php-app

--

--