XDebug
You can use PHP XDebug extension with the following options:
- start/stop by
xdebug_start_trace()
/xdebug_stop_trace()
at the specific places (e.g. before form submit), - set
xdebug.auto_trace=1
inphp.ini
for full trace, - use
xdebug_print_function_stack()
to display your current function stack, - use
xdebug.remote_enable=1
inphp.ini
to use debugger directly from IDE for step-by-step debugging.
Check: XDebug Docs.
See my suggested xdebug.ini
config file for PHP.
DTrace
If your system supports DTrace (e.g. OS X) and your PHP has been configured with DTrace static probes (php -i | grep dtrace
), the following command will trace all your function calls:
sudo dtrace -qn 'php*:::function-entry { printf("%Y: PHP function-entry:\t%s%s%s() in %s:%d\n", walltimestamp, copyinstr(arg3), copyinstr(arg4), copyinstr(arg0), basename(copyinstr(arg1)), (int)arg2); }'
If you're using Apache, you may re-run your CMS by using builtin PHP server, e.g.:
php -S localhost:8080
then access your site at http://localhost:8080/, so when you submit the form - you should see trace output containing all functions that were called as result of loaded page.
To use even more probes, check my dtruss-php.d
script.