Xdebug is a PHP extension which provides debugging and profiling capabilities. A Windows Xampp download starts here: http://www.xdebug.org/wizard.php. This page has a wizard based on the php.ini.

A download instruction may look like this:

xdebug instructions

Download the library php_xdebug-2.2.5-5.4-vc9.dll and place it in C:\xampp\tmp.

Then change the php.ini in C:\xampp\php:

[XDebug]
zend_extension = C:\xampp\php\ext\php_xdebug-2.2.5-5.4-vc9.dll
;xdebug.profiler_append = 0
xdebug.profiler_enable = 1
;xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "C:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
;xdebug.remote_enable = 0
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.trace_output_dir = "C:\xampp\tmp"

and restart Apache from the Xampp control panel.

Each request will now result in a xdebug file in the C:\xampp\tmp folder. This text file contains all the collected information but not the analysis. WinCacheGrind is is a viewer for cachegrind.out files generated by xdebug. Download here: http://sourceforge.net/projects/wincachegrind/. Open the program and load the xdebug file.

A typical view may look like this:

xebug output

It is also possible to generate a xdebug file only when required, change the ini settings to:

[XDebug]
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 1

Now the profiler will only run with ?XDEBUG_PROFILE=1 added to the url.

Added note on Xampp / Windows 10: not only does Skype block port 80 but also something called  “World Wide Web Publishing Service“. To stop this service type services.msc in Windows Powershell, the services open in new tab, stop the service.

Advertisements