### 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][1].

See my suggested [`xdebug.ini`][2] config file for PHP.

### [DTrace][3]

If your system supports DTrace (e.g. OS X) and your PHP has been configured with [DTrace static probes][4] (`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.

To use even more probes, check my [`dtruss-php.d`][5] script.


  [1]: https://xdebug.org/docs/
  [2]: https://github.com/kenorb/kenorb/blob/master/conf/php/xdebug.ini
  [3]: https://en.wikipedia.org/wiki/DTrace
  [4]: http://php.net/manual/en/features.dtrace.dtrace.php
  [5]: https://github.com/kenorb/binfiles/blob/master/dtruss-php.d