Reputation: 41595
I'm using CakePHP 2.3 I'm getting this error when accessing a CakePHP website:
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4386075 bytes) in C:\inetpub\wwwroot\mysite\lib\Cake\Event\CakeEventManager.php on line 246
It doesn't seem to be a loop, looks like something related with sessions as it fails just after trying to read a session variable with $this->Session->read('Auth.User.isAdmin')
.
Before that, I can print and die()
without problems.
PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 12273327 bytes) in C:\inetpub\wwwroot\tlm\lib\Cake\Event\CakeEventManager.php on line 246
Update 2
After setting the limit to 1500M
PHP Fatal error: Out of memory (allocated 1307312128) (tried to allocate 23778447 bytes) in C:\inetpub\wwwroot\tlm\lib\Cake\View\View.php on line 926 PHP Fatal error: Maximum execution time of 30 seconds exceeded in C:\inetpub\wwwroot\tlm\lib\Cake\Error\ErrorHandler.php on line 116
Update 3
I'm using PHP 5.5.6. After updating to CakePHP 2.6 by replacing the lib
folder, I'm getting the same error multiple times and after like 30 lines of that same error, I get the memory one.
PHP Strict Standards: Only variables should be assigned by reference in C:\inetpub\wwwroot\tlm\app\Plugin\Combinator\View\Helper\CombinatorHelper.php on line 33
PHP Strict Standards: Only ...
PHP Strict Standards: Only ...
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 3704512 bytes) in C:\inetpub\wwwroot\tlm\lib\Cake\View\View.php on line 958
PHP Strict Standards: Only variables should be assigned by reference in C:\inetpub\wwwroot\tlm\app\Plugin\Combinator\View\Helper\CombinatorHelper.php on line 33
PHP Strict Standards: Only ...
PHP Strict Standards: Only ...
Upvotes: 0
Views: 5825
Reputation: 1
I had the same error and this helped:
I simply changed the $this->set('votingBookings')
into $this->set('bookings')
in the controller file. hope that helps anybody. Love SO and want to contribute my 2 cents. cheers :D
Upvotes: 0
Reputation: 1792
After experiencing a similar error, it looks like the problem exists in CakeSession.php line 489:
throw new CakeSessionException(sprintf(
__d('cake_dev', 'Unable to configure the session, setting %s failed.'),
$setting
));
This seems to be causing the infinite loop, and exiting here will stop it. I don't know exactly why this is causing a loop, but the the reason it does is because CakePHP can't set some of your php.ini variables using ini_set
. If you print out $setting
and $value
at this point you'll be able to see what the problem variables are. For me is was session.auto_start
, which was set in the _defaultConfig
function in this file. I commented out the lines which set this which resolved the issue for me.
Upvotes: 0
Reputation: 7525
In such cases it helps to temporary put this method in AppController:
public function appError($method, $messages) {
die('Application error: called handler method ' . $method);
}
This usually gives me a hint where to look further.
Upvotes: 1
Reputation: 11693
Edit php.ini and set memory_limit
to great extent than currently set.
Like set memory_limit = 512M
Update
increase max_execution_time
Upvotes: 0