Dorokhov.codes

Xdebug profiler

To set up Xdebug for profiling we should set the next parameters:

xdebug.mode = profile
xdebug.output_dir = /app/runtime/xdebug

To generate a profile report, we need to access a PHP script or application in a way that triggers the execution of the code we want to profile. For example, we can open a PHP application in a web browser or run a PHP script from the command line.

The files will have a .cachegrind extension.

Analyzing report files

To analyze the profile data, you can use various tools such as:

  • KCacheGrind: A popular profiling data visualization tool.
  • WebGrind: A web-based alternative to KCacheGrind.