Allow override of fpm listen directive using PHP_FPM_LISTEN.

This commit is contained in:
Hans Rakers
2020-07-21 15:23:20 +02:00
parent 6179aa1fc1
commit d09013afb6
2 changed files with 13 additions and 2 deletions

View File

@@ -261,7 +261,8 @@ RUN set -eux; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*
ENV PHP_INI_DIR /usr/local/etc/php
ENV PHP_INI_DIR="/usr/local/etc/php" \
PHP_FPM_LISTEN=9000
RUN set -eux; \
mkdir -p "$PHP_INI_DIR/conf.d"; \
@@ -317,7 +318,7 @@ RUN set -eux; \
echo 'daemonize = no'; \
echo; \
echo '[www]'; \
echo 'listen = 9000'; \
echo 'listen = ${PHP_FPM_LISTEN}'; \
} | tee php-fpm.d/zz-docker.conf
# Override stop signal to stop process gracefully

View File

@@ -14,3 +14,13 @@ Because we have some legacy Symfony apps running that will eventually be phased
* MySQL 5.7.30
See the [README](https://github.com/docker-library/docs/blob/master/php/README.md) of the official PHP Docker image for information on how to use this image.
## Differences with the original image
There are two deviations from the original image. This image contains a backported patch to fpm that changes the order in which configuration files are included from `/usr/local/etc/php-fpm.d`. By default in PHP 5.3 there was no sorting on the glob, causing files to be included in whatever order they appeared in the filesystem, which can differ from system to system. The patch removes the `GLOB_NOSORT` from the call to glob(), causing the files to be included in a alphabetic order. See [Dockerfile](Dockerfile) for details.
This image also allows you to override the default listen directive of fpm. By default, it will listen on `0.0.0.0:9000`, but you can override this using the environment variable `PHP_FPM_LISTEN`. For example:
```
docker run -it -e PHP_FPM_LISTEN="localhost:9000" hrak/php-5.3:latest
```