Get complete stack trace for one-line fatal php error

2.9k views Asked by At

I got the following error message in my php error logs:

PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 5 bytes) in /lib/Zend/Db/Statement/Pdo.php on line 284

However, I want the complete stack trace, any idea how do I get it?

2

There are 2 answers

0
UnskilledFreak On BEST ANSWER

Looks like your PHP config (php.ini) doesn't allow more than 1GB of memory, thats really huge for PHP scripting.

make sure u don't procedure an endless loop. When perform an endless loop with huge files or large database queries, it can happen that the memory gets full before the script stopped working by max_execution_time error.

If your provider allows, you can extend the memory usage by give it ini_set("memory_limit","2G") or more if needed (not recommended).

if u really want to debug this, use php "self-debuggers" in this case, put

echo "<pre>".print_r(debug_backtrace(),true)."</pre>";
exit;

before the error occurs, this display the full stack tree with args, methods, ...

You also can store the output of debug_backtrace() in a var and handle it by yourself.

0
Adil On

You can see Xdebug with stack trace.

http://www.xdebug.org/