Skip to content

Commit 6ef4fd4

Browse files
authored
Merge pull request #38 from sourceboat/feature/php-fpm-env-vars
Added php-fpm environment variables
2 parents c6724cb + f246d2a commit 6ef4fd4

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="0" \
55
PHP_OPCACHE_MEMORY_CONSUMPTION="192" \
66
PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10" \
77
PHP_MEMORY_LIMIT="512M" \
8-
PHP_MAX_EXECUTION_TIME="60"
8+
PHP_MAX_EXECUTION_TIME="60" \
9+
PHP_FPM_MAX_CHILDREN="100" \
10+
PHP_FPM_MAX_REQUESTS="1000" \
11+
PHP_FPM_PM="ondemand" \
12+
PHP_FPM_PROCESS_IDLE_TIMEOUT="10s"
913

1014
RUN apk info \
1115
&& echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories \

usr/local/etc/php-fpm.d/zz-fpm.conf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[www]
22
; Ondemand process manager
3-
pm = ondemand
3+
pm = ${PHP_FPM_PM}
44

55
; The number of child processes to be created when pm is set to 'static' and the
66
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
@@ -11,18 +11,18 @@ pm = ondemand
1111
; forget to tweak pm.* to fit your needs.
1212
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
1313
; Note: This value is mandatory.
14-
pm.max_children = 100
14+
pm.max_children = ${PHP_FPM_MAX_CHILDREN}
1515

1616
; The number of seconds after which an idle process will be killed.
1717
; Note: Used only when pm is set to 'ondemand'
1818
; Default Value: 10s
19-
pm.process_idle_timeout = 10s;
19+
pm.process_idle_timeout = ${PHP_FPM_PROCESS_IDLE_TIMEOUT};
2020

2121
; The number of requests each child process should execute before respawning.
2222
; This can be useful to work around memory leaks in 3rd party libraries. For
2323
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
2424
; Default Value: 0
25-
pm.max_requests = 1000
25+
pm.max_requests = ${PHP_FPM_MAX_REQUESTS}
2626

2727
; Make sure the FPM workers can reach the environment variables for configuration
2828
clear_env = no

0 commit comments

Comments
 (0)