A php application executing inside a docker container
docker run -d -v "./app:/app" php:fpm
complains that the default value of post_max_size (8MB) is too small and I should increase it to 32MB.
Problem is, there is no php.ini in that docker image:
# ls -R /usr/local/etc/
/usr/local/etc/:
pear.conf php php-fpm.conf php-fpm.conf.default php-fpm.d
/usr/local/etc/php:
conf.d
/usr/local/etc/php/conf.d:
docker-php-ext-mysqli.ini docker-php-ext-pcntl.ini docker-php-ext-sodium.ini
/usr/local/etc/php-fpm.d:
docker.conf www.conf www.conf.default zz-docker.conf
When I append post_max_size = 32M
to any of the files under /usr/local/etc/php-fpm.d, then the container stops during startup with error message
[22-Aug-2018 01:38:09] ERROR: [/usr/local/etc/php-fpm.d/www.conf:424] unknown entry 'post_max_size'
[22-Aug-2018 01:38:09] ERROR: Unable to include /usr/local/etc/php-fpm.d/www.conf from /usr/local/etc/php-fpm.conf at line 424
[22-Aug-2018 01:38:09] ERROR: failed to load configuration file '/usr/local/etc/php-fpm.conf'
[22-Aug-2018 01:38:09] ERROR: FPM initialization failed
When I create a new file /usr/local/etc/php/php.ini
with content
post_max_size = 32M
then it has no effect. Where should I set this value when using this docker image php:fpm?
The first solution that worked for me was to set the container's environment variable PHPRC to the path of a directory where I placed a php.ini
file containing the required setting.