Re: Proposal: php.ini environment variable fallback value
| From: | Michał Marcin Brzuchalski | Date: | Mon, 27 Jul 2020 05:18:02 +0000 |
| Subject: | Re: Proposal: php.ini environment variable fallback value | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-111198@lists.php.net to get a copy of this message | ||
Hi Michael,
niedz., 26 lip 2020, 06:22 użytkownik Michael Morris <tendoaki@gmail.com>
napisał:
> PHP's ini values are already a bit of a mess. You have a global php.ini
> file, and then most PHP ini directives can be set per directory using the
> .htaccess file. About a third can be set at runtime. This makes tracking
> down where a setting came from a bit of a headache unless care is taken.
> This proposal promises to make the situation even more complicated.
>
> Also, what would this solve that using .htaccess files to override the
> default values not solve aside from the rare settings that cannot be set
> per directory?
>
Bear in mind that .htaccess has a very narrow use and it's kind oh thing
Apache2 related and not PHP specific!
Personally I like the idea of setting ini directives via environment
variables but not by a complex syntax in ini files but rather by looking up
for a directive by environment variable name and setting it up directly for
instance:
PHP_MEMORY_LIMIT=1G php script.php
Being equivalent of:
php -dmemory_limit=1G script.php
This would allow to avoid changes in php.ini file in containers with php or
php-fpm like Docker ones and to adjust ini directive values by simple
environment variables.
I believe there should be no two ini directives which could be ambiguous
like for eg. "memory_limit" and "memory.limit" and cause issues on ini
directives lookup by env variable name like PHP_MEMORY_LIMIT.
Cheers,
Michał Marcin Brzuchalski
>