github.com/ddev/ddev@v1.23.2-0.20240519125000-d824ffe36ff3/docs/content/users/debugging-profiling/xdebug-profiling.md (about)

     1  # Xdebug Profiling
     2  
     3  Although DDEV has more sophisticated profiling capabilities with [xhprof](xhprof-profiling.md) and [Blackfire](blackfire-profiling.md), it also has built-in support for [Xdebug profiling](https://xdebug.org/).
     4  
     5  ## Basic usage
     6  
     7  * Create the directory `.ddev/xdebug`, which is where the output files will be dumped.
     8  * Switch Xdebug to profiling mode by adding this in `.ddev/php/xdebug.ini`:
     9  
    10      ```ini
    11      xdebug.mode=profile
    12      xdebug.start_with_request=yes
    13      xdebug.output_dir=/var/www/html/.ddev/xdebug
    14      xdebug.profiler_output_name=trace.%c%p%r%u.out
    15      ```
    16  
    17  * Enable Xdebug with [`ddev xdebug on`](../usage/commands.md#xdebug).
    18  * Make an HTTP request to the DDEV project and the profile will be located in `.ddev/xdebug` directory.
    19  * Analyze it with any call graph viewer, for example [kcachegrind](https://kcachegrind.github.io/html/Home.html).
    20  * When you’re done, execute `ddev xdebug off` to avoid generating unneeded profile files.
    21  * You can also toggle Xdebug on and off using `ddev xdebug toggle`.
    22  
    23  ## Information Links
    24  
    25  * [Xdebug profiling docs](https://xdebug.org/docs/profiler)
    26  * [kcachegrind](https://kcachegrind.github.io/html/Home.html)