Skip to main content
4 of 4
deleted 26 characters in body
kenorb
  • 14.3k
  • 10
  • 98
  • 168

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 in php.ini for full trace,
  • use xdebug_print_function_stack() to display your current function stack,
  • use xdebug.remote_enable=1 in php.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); }'

This should work in Apache, if not, 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.

For more scripts, check my dtruss-lamp repository.

kenorb
  • 14.3k
  • 10
  • 98
  • 168