As PHP-CLI has a different ini file, this often leads to misconfiguration.
What we can do, for a «unix shebang» PHP shell script, is to set ini keys on the fly directly on the shebang line, like so:
#!/usr/bin/php -d memory_limit=512M
<?php
phpinfo();
exit;
Then to see if php had understood, using phpinfo()
:
./myphpProg | grep memory
Correct shell output should contain:
memory_limit => 512M => 512M
man php
-d foo[=bar] Define INI entry foo with value bar
Without using the Unix shebang mechanism, we can similarly pass one (or many) -d
arguments in the command line, or a dedicated start-up script:
php -d memory_limit=512M myphpProg