Run PHP cli script with memory limit

Use -d option to override the memory limit or other PHP parameters on the command line without modifying php.ini:

php -d memory_limit=1024M script.php
You can use -1 as value to set your memory limit to no limit