php cli memory limit

IIRC, an unlimited memory_limit isn't supported by the CLI (I'll try to find a source for this) but for now, try passing it into the command:

php -d memory_limit=128M my_script.php

UPDATE

Apparently I was dreaming about the unlimited memory_limit not being supported for php cli. Regardless, it looks like the value from the ini is ignored. The simplest solution should then be to specifically set it in the php command calling the script.

UPDATE2

To answer the question of where the memory limit is coming from, it's most likely being set in the script itself using 'ini_set'.