Skip to content

Commit 4dc21b6

Browse files
committed
set php-fpm to 1 static worker and enable env access
1 parent 515ed8d commit 4dc21b6

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

root/etc/cont-init.d/20-config

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,18 @@ mkdir -p \
2020
printf "; Edit this file to override php.ini directives and restart the container\\n\\ndate.timezone = %s\\n" "$TZ" > /config/php/php-local.ini
2121
# copy user php-local.ini to image
2222
cp /config/php/php-local.ini /etc/php7/conf.d/php-local.ini
23-
#fix php-fpm log location
23+
#fix php-fpm log to stderr
2424
sed -i "s#;error_log = log/php7/error.log.*#error_log = /dev/stderr#g" /etc/php7/php-fpm.conf
25+
#fix php-fpm PATH
26+
echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php7/php-fpm.conf
2527
#fix php-fpm user
2628
sed -i "s#user = nobody.*#user = abc#g" /etc/php7/php-fpm.d/www.conf
2729
sed -i "s#group = nobody.*#group = abc#g" /etc/php7/php-fpm.d/www.conf
30+
#fix php-fpm clean_env to allow access to ENVs
31+
sed -i 's/;clear_env = no/clear_env = no/g' /etc/php7/php-fpm.d/www.conf
32+
#fix php-fpm to have a static single worker
33+
sed -i 's/pm = dynamic/pm = static/' /etc/php7/php-fpm.d/www.conf
34+
sed -i 's/pm.max_children = 5/pm.max_children = 1/' /etc/php7/php-fpm.d/www.conf
2835
# create override for www.conf if it doesn't exist
2936
[[ ! -f /config/php/www2.conf ]] && \
3037
printf "; Edit this file to override www.conf and php-fpm.conf directives and restart the container\\n\\n; Pool name\\n[www]\\n\\n" > /config/php/www2.conf

0 commit comments

Comments
 (0)