CakePHP : Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 52 bytes)

倖福魔咒の 提交于 2019-12-01 03:17:12

You can increase memory limit by using in your controller action

ini_set('memory_limit', '256M');

Also you can increase time out limit

set_time_limit(0); Infinite

Increase memory limit in php.ini, this is not is appropriate solution at all.

this case can be also occurred from code e.g infinite loop, process large amount data, or even database queries You should check code, there might have been infinite loop or such type case.

The error is obvious and it is due to exceeding memory limits by setting in your ini files or .htaccess. You can also set via php as Anubhay wrote. Following variables are your concern

php_value post_max_size 1000M
php_value upload_max_filesize 2500M
php_value max_execution_time 6000000
php_value max_input_time 6000000
php_value memory_limit 2500M

You can optimize query data by using cake behavior containable. It is better practice to optimize your code/data rather than increasing memory size.

Thanks

Try...
Allowed memory size 
ini_set('memory_limit', '-1');
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!