diff --git a/5.5/fpm/Dockerfile b/5.5/fpm/Dockerfile index 4895ef98..74bca013 100644 --- a/5.5/fpm/Dockerfile +++ b/5.5/fpm/Dockerfile @@ -65,7 +65,42 @@ COPY docker-php-ext-* /usr/local/bin/ #### WORKDIR /var/www/html -COPY php-fpm.conf /usr/local/etc/ + +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 don'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"] diff --git a/5.5/fpm/php-fpm.conf b/5.5/fpm/php-fpm.conf deleted file mode 100644 index 3d5bc497..00000000 --- a/5.5/fpm/php-fpm.conf +++ /dev/null @@ -1,28 +0,0 @@ -; This file was initially adapated from the output of: (on PHP 5.6) -; grep -vE '^;|^ *$' /usr/local/etc/php-fpm.conf.default - -[global] - -error_log = /proc/self/fd/2 -daemonize = no - -[www] - -; if we send this to /proc/self/fd/1, it never appears -access.log = /proc/self/fd/2 - -user = www-data -group = www-data - -listen = [::]:9000 - -pm = dynamic -pm.max_children = 5 -pm.start_servers = 2 -pm.min_spare_servers = 1 -pm.max_spare_servers = 3 - -clear_env = no - -; Ensure worker stdout and stderr are sent to the main error log. -catch_workers_output = yes \ No newline at end of file diff --git a/5.6/fpm/Dockerfile b/5.6/fpm/Dockerfile index b769e6e7..16be332a 100644 --- a/5.6/fpm/Dockerfile +++ b/5.6/fpm/Dockerfile @@ -65,7 +65,42 @@ COPY docker-php-ext-* /usr/local/bin/ #### WORKDIR /var/www/html -COPY php-fpm.conf /usr/local/etc/ + +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 don'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"] diff --git a/5.6/fpm/php-fpm.conf b/5.6/fpm/php-fpm.conf deleted file mode 100644 index 3d5bc497..00000000 --- a/5.6/fpm/php-fpm.conf +++ /dev/null @@ -1,28 +0,0 @@ -; This file was initially adapated from the output of: (on PHP 5.6) -; grep -vE '^;|^ *$' /usr/local/etc/php-fpm.conf.default - -[global] - -error_log = /proc/self/fd/2 -daemonize = no - -[www] - -; if we send this to /proc/self/fd/1, it never appears -access.log = /proc/self/fd/2 - -user = www-data -group = www-data - -listen = [::]:9000 - -pm = dynamic -pm.max_children = 5 -pm.start_servers = 2 -pm.min_spare_servers = 1 -pm.max_spare_servers = 3 - -clear_env = no - -; Ensure worker stdout and stderr are sent to the main error log. -catch_workers_output = yes \ No newline at end of file diff --git a/7.0/fpm/Dockerfile b/7.0/fpm/Dockerfile index 88d5b254..0be4cfd8 100644 --- a/7.0/fpm/Dockerfile +++ b/7.0/fpm/Dockerfile @@ -65,7 +65,42 @@ COPY docker-php-ext-* /usr/local/bin/ #### WORKDIR /var/www/html -COPY php-fpm.conf /usr/local/etc/ + +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 don'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"] diff --git a/7.0/fpm/php-fpm.conf b/7.0/fpm/php-fpm.conf deleted file mode 100644 index 3d5bc497..00000000 --- a/7.0/fpm/php-fpm.conf +++ /dev/null @@ -1,28 +0,0 @@ -; This file was initially adapated from the output of: (on PHP 5.6) -; grep -vE '^;|^ *$' /usr/local/etc/php-fpm.conf.default - -[global] - -error_log = /proc/self/fd/2 -daemonize = no - -[www] - -; if we send this to /proc/self/fd/1, it never appears -access.log = /proc/self/fd/2 - -user = www-data -group = www-data - -listen = [::]:9000 - -pm = dynamic -pm.max_children = 5 -pm.start_servers = 2 -pm.min_spare_servers = 1 -pm.max_spare_servers = 3 - -clear_env = no - -; Ensure worker stdout and stderr are sent to the main error log. -catch_workers_output = yes \ No newline at end of file diff --git a/fpm-Dockerfile-block-2 b/fpm-Dockerfile-block-2 index e9989491..1b58a63b 100644 --- a/fpm-Dockerfile-block-2 +++ b/fpm-Dockerfile-block-2 @@ -1,5 +1,40 @@ WORKDIR /var/www/html -COPY php-fpm.conf /usr/local/etc/ + +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 don'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"]