webgrind on wamp webgrind on wamp php php

webgrind on wamp


Webgrind is a parser/viewer for a profiling file format called cachegrind. The PHP extension Xdebug can (among other very useful things) generate these. For webgrind to work, Xdebug needs to be installed and enabled.

  1. Make sure Xdebug is installed and working (see the Xdebug docs for info on how to do that)
  2. Have Xdebug generate a profiling report by requesting a local PHP file
  3. Load webgrind in the browser and select a file in the popup-menu at the top
  4. Press update, and hopefully everything should work

The wiki on Google Code has more on configuring webgrind.


1) Download XDebug from their download page.

2) Put all DLL files in your PHP extension directory: C:\wamp\bin\php\php5.x.x\ext

3) Add the following line in your php.ini file located in C:\wamp\bin\php\php5.x.x:

zend_extension = c:\wamp\bin\php\php5.3.0\ext\php_xdebug-2.1.0-5.3-vc6.dll

4) Add also the following section to your php.ini (search for the [xdebug] section first to make sure it does not exist yet):

[xdebug]xdebug.profiler_enable = 1xdebug.profiler_output_dir = "c:\wamp\www\webgrind\tmp"xdebug.profiler_output_name = cachegrind.out.%t.%p

5) Restart Wamp and verify that the extension was loaded. To do so, add a file pi.php in C:\wamp\www\ and put the following code in it:

<?php    phpinfo();?>

6) Check the output by opening your browser at http://localhost/pi.php and search for XDebug.

7) Download Webgrind from their download page and extract in in your www folder.

8) Edit the config.phpfile located in C:\wamp\www\webgrind\ to change the storage directories:

static $storageDir = 'c:\wamp\www\webgrind\tmp';static $profilerDir = 'c:\wamp\www\webgrind\tmp';

9) In the Webgrind directory where you have extracted the code, add an .htaccess file and put this content in it to avoid webgrind from profiling itself:

php_flag xdebug.profiler_enable 0

10) Rerun the http://localhost/pi.php script to generate some profiling data.

11) Open your browser with http://localhost/webgrind to display the results. Do not forget to click the Update button!

This answer is based on an answer provided by Jacob Moen. You can view the original source here.


It is good to watch if the application becomes SLOW, had problems with it because of the settings of Cachegrind.

Good luck!

My settings are Wamp 2.4, Apache 2.4, PHP 5.4 and MySQL 5.6

[Portugues pt_BR]

É bom prestar atenção se a aplicação se tornar LENTA, tive problemas com isso por causa das configurações do cachegrind.

Boa sorte!

Minhas configurações são Wamp 2.4, Apache 2.4, PHP 5.4 e MySQL 5.6