0
votes

The original installation was on Ubuntu 14.04 with PHP 5.5.9 and CakePHP 5.4.1. After migrating to Ubuntu 16.04 with PHP 7.0.30 I updated CakePHP to 2.10.4 mainly by exchanging the lib folder. Everything works fine in the web interface, even the memory consuming tasks of the application. But the CLI is broken. Every call to 'app/Console/cake' throws a 'PHP Fatal error'.

root@watt18:/var/www_external/app# Console/cake bake
PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 8192 bytes) in /var/www_external/lib/Cake/Console/ConsoleOptionParser.php on line 510
PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 32768 bytes) in /var/www_external/lib/Cake/I18n/I18n.php on line 1

The 'in' part changes from call to call. Searching the web I could not find any comparable topic. I checked the persmissions on all the folders inside 'app' but could not find any differences to the original installation. I tried to debug but couldn't get really far yet. Up to the line return ShellDispatcher::run($argv); in Console/cake.php everything is fine.

I get the same result when making a call inside the original cakephp folder from a fresh download.

I have no idea where all the memory gets lost.I would be happy about any hint to what might cause the problem or how to continue with debuging.

1
2 MB of memory is waaaaay too low for pretty much any PHP script that is more than just echo 'hello world';, let alone for a framework, especially on the command line where it's expected that load heavy tasks are being performed. - ndm
Uups! Of course you are right. I was misled by the digits. The definition of the VM is in KiB, so total memory size is 2GB what has always been enough for the original installation. I do not understand where PHP get's its allowed memory size from. The setting is 128MB. Changing it to -1 temporarily solves the problem, as MaxGeek suggested. - Beat
It can be defined/overridden in so many places (ini files, vhost configurations, htaccess files, PHP code...), I really can't tell what might be going on in your environment. - ndm

1 Answers

0
votes

set memory_limit = -1 in your php.ini

but this is not a good solution , you may have a memory leake somewhere

please double check your statements , specialy if there is a loop with many memory usage