The default signal used by docker to stop a container is SIGTERM and
that signal is understood by PHP-FPM as immediate termination.
This means that `php-fpm` won't wait for in-flight requests to finish
before of stopping the workers and main process. This behaviour is quite
undesired for production environments and should be avoided as much as
possible.
This implementation is meant to be extremely simple and only address the
stop signal used when running `docker stop`. `php-fpm` signal choices
are somewhat peculiar (`SIGUSR2` for example) and if we want to "fix"
them we would have to use a tool (e.g.: `dumb-init`).
More info:
- https://linux.die.net/man/8/php-fpm
- https://docs.docker.com/engine/reference/builder/#stopsignal
- https://github.com/Yelp/dumb-init
- https://github.com/usabilla/php-docker-template/pull/102
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
This will hopefully help folks with the confusion around installing packages like "php-apcu" and then wondering why they don't actually "work" (because they pull in Debian's PHP, and that's not what this image packages).