Skip to content

Commit 07d235a

Browse files
committed
Fix docs, comments and enhance example
1 parent 3d9c26e commit 07d235a

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,21 @@ replace the `.` in the settings by `__`. Examples:
176176
Upper case allowed (will be lower-cased):
177177
```
178178
PHPINI__SESSION__SAVE_HANDLER=redis
179+
PHPINI__SESSION__SAVE_PATH='"tcp://redis:6379?persistent=1&weight=1&database=10&prefix=PHPSESSID:"'
179180
PHPINI__REDIS__SESSION__LOCKING_ENABLED=1
180181
```
181182

182-
Or:
183+
Or (lower case also fine):
183184
```
184185
PHPFPM__request_terminate_timeout=30s
185186
PHPFPM__pm__max_children=15
186187
```
187188

189+
**Note**: make sure that potentially required double quotes `"` are part of the
190+
"string" that ends up in the ENV variable, so quote as necessary, because this
191+
string is copied "as is" to the ini files. See example above for the
192+
`PHPINI__SESSION__SAVE_PATH` - this would be the syntax for a `.env` file.
193+
188194
## Example usage
189195

190196
Copy the files from `example-app/` folder to your application, tweak, and you are

example-app/.env.example

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ pm.max_children = 5
4747
# PHP settings by env vars
4848
# -----------------------------------------
4949

50-
# Example of setting php.ini settings
50+
# Example of setting php.ini settings, UPPER CASED
5151
PHPINI__SESSION__SAVE_HANDLER=redis
52+
PHPINI__SESSION__SAVE_PATH='"tcp://redis:6379?persistent=1&weight=1&database=10&prefix=PHPSESSID:"'
5253
PHPINI__REDIS__SESSION__LOCKING_ENABLED=1
5354

54-
# Example of setting PHP-FPM settings
55-
PHPFPM__REQUEST_terminate_timeout=30s
55+
# Example of setting PHP-FPM settings, lower cased also possible
56+
PHPFPM__request_terminate_timeout=30s
5657
PHPFPM__pm__max_children=15

files/entrypoint-extras.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,9 @@ if env | grep -q '^PHPINI__'; then
103103
# Transform key: PHPINI__this__setting => this.setting
104104
key=${name#PHPINI__}
105105
key=$(printf '%s' "$key" | sed 's/__/./g')
106-
# Lowercase in POSIX sh (dash/busybox) without bash-specific substitution
107106
key=$(printf '%s' "$key" | tr '[:upper:]' '[:lower:]')
108107
# Append as "key = value" (value is written as-is; quote in ENV if needed)
109-
printf '* setting in php.ini: %s = %s\n' "$key" "$value"
108+
printf '* Setting in php.ini: %s = %s\n' "$key" "$value"
110109
printf '%s = %s\n' "$key" "$value" >> "$CUSTOM_INI"
111110
# Unset them, not relevant to the running containers
112111
unset "$name"

0 commit comments

Comments
 (0)