I am trying to override phi cli configuration with my custom php.ini
My custom php.ini
max_execution_time = 90
memory_limit = 256M
safe_mode = Off
Running php cli
php -c /home/env/php.ini -r 'phpinfo();' | grep 'memory_limit'
exits
memory_limit => 256M => 256M
However, custom php.ini does not seem to override max_execution_time or safe_mode, as it displays 0 and On, not 90 and Off.
Running this simple script
<?php echo 'memory_limit: ' . ini_get('memory_limit');
displays the default cli configuration (128M), not 256M as expected.
Running this simple script
<?php echo 'max_execution_time: ' . ini_get('max_execution_time');
yields 90 as expected.
So far, I have managed to redefine only one configuration directive at runtime, so any help really appreciated how to redefine several configuration directives.
Edit:
php -a
php > parse_ini_file('/home/env/php.ini');
no errors are output, so I think my custom php.ini is ok. I would just find that doing
<?php echo 'memory_limit: ' . ini_get('memory_limit'); phpinfo();
= > (none). , . PHP CLI, , php.ini, , .
:
shebang, . shebang .
php -d max_execution_time=90 -d memory_limit=256M -d safe_mode=Off -f test.php