"php --help" results in "PHP memory exhausted" error on Ubuntu

Mark Soper picture Mark Soper · Jan 15, 2011 · Viewed 13.7k times · Source

PHP Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 523800 bytes) in Unknown on line 0

Same thing occurs with "php5 --help"

I have already researched this and read that I should: 1) increase the memory limit in php.ini - it's at 128MB in all instances of php.ini - should be enough to run php cli help 2) make the script more memory efficient - obviously doesn't apply to --help

Please help if you can ?

Answer

losttime picture losttime · Apr 19, 2011

Check the php.ini file for PHP CLI (/etc/php5/cli/php.ini).

Make sure the memory_limit declaration has its units set:

memory_limit = 32M

not

memory_limit = 32

It fixed it for me. I hope it works for you too.