Do you know any solution to recover from the PHP fatal error : "Allowed memory size ... exhausted"
I have a shutdown function that is called when a fatal error appear. This function create an ErrorException from it, and logs it.
The problem is : when there is no more memory available, it can't log the error (I log in Firebug, via FirePHP, with Zend Framework).
So what i mean by "how to recover from it", is how to perform basic error log, and let Zend Framework send the Headers, so that the error is logged (in Firebug in my case) as any other error ?
Thanks
To fix the error, you have to manually increase the default PHP memory limit set for your server.
Increasing the PHP memory limit The default memory limit is 256M and this is usually more than sufficient for most needs. If you need to raise this limit, you must create a phprc file.
This worked fine for me:
try {
ini_set('memory_limit', (ini_get('memory_limit')+1).'M');
} catch(Exception $e) {}
This assumes your memory limit is in the format 123M
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With