symfony-docker
symfony-docker copied to clipboard
php config file order
As php takes the last ini value set, in frankenphp/conf.d
The order currently is:
app.dev.ini app.ini
Expected would be:
app.ini app.dev.ini
Should app.dev.ini be renamed so it is loaded after app.ini? Currently there is only one setting in app.dev.ini but more could be added and I believe the expected behavior would be it take precedence over settings in app.ini.
Yes, a PR would be welcome.
We currently have these :
Is there any preference?
rename it to app.zzdev.ini or zzz-app.dev.ini?
With number ? 00-app.ini
& 01-app.dev.ini
?
With number ?
00-app.ini
&01-app.dev.ini
?
Numbers will move them above the docker-php-ext-xyz.ini I would think we want our config to supersede them so I used the z prefix to move them to the bottom as php uses the last set value. So maybe z01-app.ini, z02-other.ini, ... Again normally the dev is loaded last so zzz-dev.ini seems most likely to be loaded last.
You could also set the PHP_INI_SCAN_DIR
environment variable to 2 paths. This will override the --with-config-file-scan-dir
option in /usr/local/bin/php-config
.
See: https://www.php.net/manual/en/configuration.file.php#configuration.file.scan
ENV PHP_INI_SCAN_DIR="$PHP_INI_DIR/conf.d:$PHP_INI_DIR/app.conf.d"
This way the conf.d
directory is scanned first for ini files, and then the app.conf.d
is scanned for ini files.
This way you can sort the app's ini files in numerical order.
/usr/local/etc/php/app.conf.d/10-app.ini
/usr/local/etc/php/app.conf.d/20-app.dev.ini - or - 20-app.prod.ini
You can verify this with php --ini
, which results in:
Configuration File (php.ini) Path: /usr/local/etc/php
Loaded Configuration File: (none)
Scan for additional .ini files in: /usr/local/etc/php/conf.d:/usr/local/etc/php/app.conf.d
Additional .ini files parsed: /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini,
/usr/local/etc/php/app.conf.d/app.ini