Profiling PHP Applications with Xdebug


Xdebug is a PHP extension for powerful debugging. It supports stack and function traces, profiling information and memory allocation and script execution analysis.

Install Xdebug on Windows

Download php_xdebug.dll from official website. Edit php.ini like this:


xdebug.profiler_enable         = 1
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_name    = cachegrind.out.%p
xdebug.profiler_output_dir     = "..\ext\xdebug_profilers"
xdebug.trace_output_dir        = "..\ext\xdebug_traces"
xdebug.auto_trace              = 0
xdebug.collect_params          = 4
xdebug.collect_return          = 1
xdebug.show_mem_delta          = 1

zend_extension                 = "..\ext\php_xdebug.dll"

We can get more configuration information from the official documents. After edited the config file, restart the web server.

    //  Code to trace ...

WinCacheGrind is a viewer for cachegrind.out files generated by Xdebug and QCacheGrind (KCacheGrind) Windows build is a GUI to parse and view Xdebug trace files. If you got MSVCP100.dll Missing error, download and install Microsoft Visual C++ 2010 Redistributable Package (x86, x64).

Profiling PHP Applications with Xdebug

Profiling PHP Applications with Xdebug

Related Article

Debugging with Xdebug and PhpStorm on OS X
Profiling PHP Applications with XHProf

0.00 avg. rating (0% score) - 0 votes