php
php copied to clipboard
Keep default log_limit value
PHP default configuration says that it should be 1024: https://www.php.net/manual/en/install.fpm.configuration.php

I think that we need to make things consistent as close as possible to defaults coming from PHP itself, as these are PHP base images.
Specifying different log_limit
should be a project-specific thing, and it should not be specified in the base image.
I see that changes were introduced in https://github.com/docker-library/php/pull/725#issuecomment-443540114.
@yosifkit Do you think that the php alpine base image should stick to the defaults provided in PHP docs?
This is definitely more complicated than just resetting this value back to the default -- see https://github.com/docker-library/php/issues/878#issuecomment-938595965, which has some good details about this particular land-mine. :see_no_evil:
@tianon Thanks for pointing to the comment!
There are multiple things being discussed:
- multiple error messages being logged ( nginx, php-fpm)
fastcgi.logging = Off
and how to fix them. - changing log_limit value was mentioned ( as some partial fix )
I'm reaching out to solve "the default configuration issue" here.
There is a default configuration for log_limit
specified log_limit = 8192
docker run php:8.0.16-fpm-alpine cat /usr/local/etc/php-fpm.d/docker.conf
result:
[global]
error_log = /proc/self/fd/2
; https://github.com/docker-library/php/pull/725#issuecomment-443540114
log_limit = 8192
[www]
; if we send this to /proc/self/fd/1, it never appears
access.log = /proc/self/fd/2
clear_env = no
; Ensure worker stdout and stderr are sent to the main error log.
catch_workers_output = yes
decorate_workers_output = no
Seems that specifying such log_limit
value is a project-specific thing for the author and such a setting should not be part of the base image, cause it should be as clean as possible and close to PHP default values.
Such a setting makes users of base images override this value when they want to stick to PHP default values.
Does it make sense? How can I contribute more to the "the default configuration issue" topic?
The default was changed for the image because the PHP maintainer that made the "decorate_workers" improvements in FPM said that the only reason they didn't increase the default line length was for backwards compatibility and commented that a larger value would be generally more useful (https://github.com/docker-library/php/pull/725#issuecomment-443540114).
Since this has been the default in the container images for over three years, setting this to a smaller value could unexpectedly break users' logging setups that rely on the PHP logging to not arbitrarily add extra newlines (e.g. using ELK to detect a backtrace and gather the related lines). So, no I don't think this value should be changed to a smaller value.
@yosifkit Keeping backwards compatibility makes sense. 👍🏻
Maybe it also makes sense to make this deviation from PHP defaults more visible, by explaining the "default" configuration of docker.conf
and other configs?
I'm looking forward to contributing here. Any suggestions on how we could make this more transparent for anyone?
(The issue I'm trying to solve here: "the conf is not well documented & it is hacky to override log_limit
")