I would like to see a log of THE WHOLE code execution of PHP script(s). Something like this: http://en.wikibooks.org/wiki/Ruby_Programming/Standard_Library/Tracer (for lack of better example; no flame please).
Is there some way how to obtain the log in PHP?
Note: I know I can use a debugger but that's not the same.
In any function you can see the whole backtrace by using debug_backtrace(...) Or you can use Xdebug profiler to profile your PHP scripts. debug_backtrace is put on a specific place in a PHP script but I want to see a log of whole code execution - from start to the end.
PHP code is executed on the server.
But, what is a stack trace? In essence, it is a rundown of every file and function that is called leading up to the error. To be clear, a stack trace doesn't include the files and functions that are touched before the error occurred, only the chain of methods that are called as the error happened.
Until version 3, PHP source code was parsed and executed right away by the PHP interpreter. PHP 4 introduced the the Zend engine. This engine splits the processing of PHP code into several phases. The first phase parses PHP source code and generates a binary representation of the PHP code known as Zend opcodes.
Xdebug is definitely what you want, but with something like callgrind from the valgrind suite as well.
Zend blog post here should give you some pointers: http://devzone.zend.com/1139/profiling-php-applications-with-xdebug/
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