php/fpm-Dockerfile-block-2
boite 57b41cfc2d Allow FPM pool to listen on IPv4 when v6 disabled
In PHP 7.2.0 a change [1] was made in response to bug [#74166] to fall
back to listening on 0.0.0.0 if IPv6 is disabled (for example with
ipv6.disable=1 Linux kernel param) instead of failing to create a
listening socket with the error "Address family not supported by
protocol (97)".

A fallback to IPv4 in such circumstances is only possible in PHP >=
7.2.0 and by specifying a port number without an address to the listen
directive.

[1]: b63c45c69e
[#74166]: https://bugs.php.net/bug.php?id=74166
2018-01-18 11:40:00 +00:00

41 lines
1.2 KiB
Plaintext

WORKDIR /var/www/html
RUN set -ex \
&& cd /usr/local/etc \
&& if [ -d php-fpm.d ]; then \
# for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf"
sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \
cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \
else \
# PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency
mkdir php-fpm.d; \
cp php-fpm.conf.default php-fpm.d/www.conf; \
{ \
echo '[global]'; \
echo 'include=etc/php-fpm.d/*.conf'; \
} | tee php-fpm.conf; \
fi \
&& { \
echo '[global]'; \
echo 'error_log = /proc/self/fd/2'; \
echo; \
echo '[www]'; \
echo '; if we send this to /proc/self/fd/1, it never appears'; \
echo 'access.log = /proc/self/fd/2'; \
echo; \
echo 'clear_env = no'; \
echo; \
echo '; Ensure worker stdout and stderr are sent to the main error log.'; \
echo 'catch_workers_output = yes'; \
} | tee php-fpm.d/docker.conf \
&& { \
echo '[global]'; \
echo 'daemonize = no'; \
echo; \
echo '[www]'; \
echo 'listen = 9000'; \
} | tee php-fpm.d/zz-docker.conf
EXPOSE 9000
CMD ["php-fpm"]