I’m trying to test a Magento cron job by running the target file from the command line. When I do, I get this error:
Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 523800 bytes) in Unknown on line 0
Line 0? Nothing happens before Line 27 (on this script). This isn’t a problem with my code. It’s a problem with PHP.
It’s actually a problem with the PHP Command Line Interface (CLI). The server was recently upgraded to Ubuntu 10.04 LTS with PHP 5.3.2. The PHP CLI module apparently has its own php.ini file, and the
memory_limit in that ini file is set incorrectly.
memory_limit = 32
memory_limit = 32M
I guess without the ‘M’ it doesn’t know what units you’re talking about.
No need to restart Apache or anything. Just try running the script again. It worked for me. I hope it works for you.