I\'m looking for a way to print the call stack in PHP.
Bonus points if the function flushes the IO buffer.
phptrace is a great tool to print PHP stack anytime when you want without installing any extensions.
There are two major function of phptrace: first, print call stack of PHP which need not install anything, second, trace php execution flows which needs to install the extension it supplies.
as follows:
$ ./phptrace -p 3130 -s # phptrace -p -s
phptrace 0.2.0 release candidate, published by infra webcore team
process id = 3130
script_filename = /home/xxx/opt/nginx/webapp/block.php
[0x7f27b9a99dc8] sleep /home/xxx/opt/nginx/webapp/block.php:6
[0x7f27b9a99d08] say /home/xxx/opt/nginx/webapp/block.php:3
[0x7f27b9a99c50] run /home/xxx/opt/nginx/webapp/block.php:10