Skip to content

Xdebug Profiling

Although DDEV has more sophisticated profiling capabilities with xhprof and blackfire.io it also has built-in support for xdebug profiling.

Basic usage

  • Create the directory .ddev/xdebug, which is where the output files will be dumped.
  • Switch XDebug to profiling mode by adding this in .ddev/php/xdebug.ini
xdebug.mode=profile
xdebug.start_with_request=yes
xdebug.output_dir=/var/www/html/.ddev/xdebug
xdebug.profiler_output_name=trace.%c%p%r%u.out
  • Enable xdebug with ddev xdebug on
  • Do a HTTP request to the DDEV project and the profile will be located in .ddev/xdebug directory.
  • Analyze it with any call graph viewer, for example kcachegrind.
  • When you're done, execute ddev xdebug off to avoid generating unneeded profile files.

Last update: July 7, 2022