12
votes

Hi i have a apps running on CakePHP v 1.3. I've updated my wamp server to v2.4.After updating i got this error message.I did these changes into my php.ini settings.


  • memory_limit = 128M
  • file_uploads = ON
  • upload_max_filesize = 128M
  • max_input_time
  • max_execution_time = 300
  • post_max_size = 128M
  • realpath_cache_size = 16k
  • realpath_cache_ttl = 120

But i'm still getting these Error message :

CakePHP : Fatal error: Allowed memory size of 536870912 bytes exhausted 
(tried to allocate 52 bytes) in C:\wamp\www\gtgcrm\cake\libs\model\
datasources\dbo\dbo_mysql.php on line 775

What i missed ? Any Suggestion will be appreciated !

4

4 Answers

10
votes

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
5
votes

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.

3
votes

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

2
votes
Try...
Allowed memory size 
ini_set('memory_limit', '-1');