Reputation: 3855
The php command doesn't seem to check whether values in php.ini make sense. Here is an example:
$ echo 'memory_limit = foobar' > /tmp/php.ini
$ php -c /tmp -r 'printf("%s\n", ini_get("memory_limit"));'
foobar
How can I ask php to fail loudly when php.ini contains junk like this?
Upvotes: 1
Views: 36
Reputation: 145512
You probably can't.
In the case of memory_limit, it's predefined as
PHP_INI_ENTRY("memory_limit", "128M", PHP_INI_ALL, OnChangeMemoryLimit)
zend_atol
G
or M
e.g.And for the purposes of memory_limit
any 0 value is discarded. Because, you know, that wouldn't make sense for maximum memory usage.
Also PHP here simply assumes that at least one of all the possible php.ini
s contains some sort of valid or sane default. So that's why (I would say) there's no loud warning for this. It's just not commonly needed. Which again - my opinion - is somewhat of a valid design choice: don't overoptimize for edge cases.
Upvotes: 1