Is there any way I can dump all variables with their values a script has into a file when the script tries to allocate more memory than it is allowed to? For debugging purposes.
Asked
Active
Viewed 101 times
1
-
How you are limiting youer memory ? thru `php.ini` ?? – Makesh Feb 27 '15 at 08:32
-
@Makesh Yes, with memory_limit – php_nub_qq Feb 27 '15 at 08:33
1 Answers
2
You can use this code:
register_shutdown_function('shutdownFunction');
function shutDownFunction() {
if ($error['type'] == 1) {
// do your stuff here
}
}
It will be called when running into your fatal error.

nl-x
- 11,762
- 7
- 33
- 61