My favorites | Sign in
Project Logo
                
Search
for
Updated Feb 12, 2009 by gugakfugl
Labels: Featured, install
Installation  
Instructions for installing webgrind

Requirements

To run webgrind you need a webserver with PHP 5 installed. Webgrind uses json_encode that is available from PHP 5.2 or as a PECL extension before that.

Xdebug does the actual profiling so that should be installed first (http://www.xdebug.org/docs/install). Then add the following to your php.ini file:

Always profile scripts with xdebug:

xdebug.profiler_enable = 1 

Alternatively, enable profiling with GET/POST parameter XDEBUG_PROFILE, e.g. http://localhost/samplepage.php?XDEBUG_PROFILE:

xdebug.profiler_enable_trigger = 1

Please refer to the Xdebug manual for further configuration settings: http://www.xdebug.org/docs/all_settings

Installation

  1. Download webgrind.
  2. Extract webgrind to a folder accessible to the webserver.
  3. Start using webgrind with your browser of choice by navigating to the URL of your webgrind install, e.g. http://localhost/webgrind.

Configuration

Webgrind can be configured by editing the config.php file in the webgrind directory, but should work with default settings provided Xdebug is installed and configured correctly.

Further configuration options are described in the config.php file itself.


Comment by MPC317, Aug 18, 2008

> Start using webgrind with your browser of choice. <

How ?

Maybe the authors are a little too close to it, but for the uninitiated a little elaboration and an example would be most helpful ... and maybe contribute to more widespread use.

Comment by wojtekd, Aug 21, 2008

does it requires specific Xcode settings? I can select cachegrind file but I got always blank page on output.

Comment by ryanam1, Sep 04, 2008

How do you use it???? why is it such a secret?? I can't find help on using this anywhere

Comment by mark.story, Sep 13, 2008

You need to get xdebug to generate cachegrind files first. Once you can get Xdebug to generate cache grinds, you can look at them. For me it found the grind files automatically.

Comment by gaukepieter, Sep 13, 2008

This worked out of the box for me on osx leopard using mamp. My xdebug cachegrind files are in '/xdebug-profiling' and I set that folder in the webgrind config file as the 'storageDir'. I'm not sure if this is needed though.

Problems like the above may be caused by a php version lower than 5.2 and/or the lack of json_encode support...

And for the people who don't get the 'start using webgrind with your browser of choice': if you put your webgrind folder in your server root, then point your browser to http://localhost/webgrind, select a file in the dropdown menu in the top right corner and click 'update' and you're done. All the nice stats should show up in your browser :)

Comment by kesoil, Oct 07, 2008

To enable xdebug profiler you need to put "xdebug.profiler_enable=1" to your php.ini.

Comment by katzke, Oct 08, 2008

In MAMP, I first had to disable the zend optimizer ... not sure if that was enabled out of the box or not because my MAMP build has gotten pretty hacked up in the past year since MAMP 1.7 came out.

Comment by jor...@jordie.org, Oct 13, 2008

You need a .htaccess file in the directory for webgrind and where your app is with this:

php_flag xdebug.profiler_enable 1
php_value xdebug.profiler_output_dir /full/path/to/save/grindfiles 
php_value xdebug.profiler_output_name cachegrind.out.%t.%p

The problem I found was that webgrind assumes this is set for its own directory and that the php values for profiler_output_dir and profiler_output_name are set. The script needs an easy override command for the output directory and output name format in the config.php file.

Comment by klianmail, Nov 17, 2008

I dont know how to use it.

Could you post a more detailed installation instructions please ?

Comment by mrproper06, Dec 09, 2008

Unable to make it work on a windows XAMPP install. The Xdebug trace shows that webgrind finds the profiling dumps and prepares to show them, but the web page doesn't have anything on it...

Comment by brownoxford, Jan 10, 2009

Just posted an article on installing and configuring webgrind here: http://www.chrisabernethy.com/php-profiling-xdebug-webgrind/

I found that one of the issues is making sure to specify a value for xdebug.profiler_output_name that wouldn't cause the file to be overwritten each time you serve a page from the same Apache process (the value defaults to using PID as a unique identifier).

Comment by julmaz, Jan 23, 2009

Hello, I try to make it works on a debian server and i just achieve to profile the code of webgrind itself, how can i profile other script which are located at the same root level directory ... ?

thx

Comment by b...@minreklame.dk, Feb 24, 2009

Hi, I made it to work with the following configuration in both /apache/bin/php.ini AND /php/php.ini:

zend_extension_ts="\path\to\ext\php_xdebug.dll"
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir="C:\xampp\tmp"
Comment by elated, Mar 10, 2009

For full guide on how to install webgrind + xdebug go here: http://anantgarg.com/2009/03/10/php-xdebug-webgrind-installation/

Comment by angelo.rigo, Apr 14, 2009

In wich section of php.ini must be written this line : xdebug.profiler_enable = 1 At the end of the php.ini file ?

Comment by gugakfugl, Apr 14, 2009

@angelo.rigo:

It doesn't matter where in the php.ini file you put the xdebug enabling line. Please refer to the documentation for xdebug for further instructions on how to set it up: http://xdebug.org/docs/

Comment by angelo.rigo, Apr 24, 2009

Is xdebug listed on the phpinfo function ? or the way i can see the extension is enabled is looking at the php.ini file ?

Comment by gugakfugl, Apr 24, 2009

@angelo.rigo:

Yes, the xdebug extension will appear in the output of phpinfo() as a separate section with version information.

Comment by alex...@yandex.ru, May 08, 2009

>The Xdebug trace shows that webgrind finds the profiling dumps and prepares to >show them, but the web page doesn't have anything on it...

Please note that webgrind (at least v 1.0) needs function "json_encode". It is a built-in function since PHP >= 5.2.0. Otherwise you shoud install it manually: http://pecl.php.net/package/json For example, use "pecl install json" and it will produce json.so module

Comment by dylan.arnold, Jun 18, 2009

Couldn't get this going until I used

xdebug.profiler_output_name = "cachegrind.out.%t.%p"

Looks nice otherwise! :)

Comment by thetrippy, Jul 02, 2009

SO, keep in mind that if you have changed the xdebug.profile_output_name to not include a pid then webgrind will not find your profiles. The reason is because it excludes its own cachegrind profiles on purpose to avoid infinite loop.


Sign in to add a comment
Hosted by Google Code