My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
Installation  
Instructions for installing webgrind
Featured, install
Updated Sep 28, 2010 by gugakf...@gmail.com

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.

Installing webgrind on production servers is highly discouraged as it might allow access to sensitive files.

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.

  • $storageDir - path to a writeable directory where webgrind will store processed cachegrind files
  • $profilerDir - If Xdebug is not installed, this variable defines a directory searched for cachegrind files. If Xdebug is installed, webgrind will look for cachegrind files defined by the xdebug.profiler_output_dir setting. The default is /tmp.

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

Comment by MPC...@gmail.com, 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 wojt...@gmail.com, Aug 21, 2008

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

Comment by ryan...@gmail.com, Sep 4, 2008

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

Comment by mark.st...@gmail.com, 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 gaukepie...@gmail.com, 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 kes...@gmail.com, Oct 7, 2008

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

Comment by kat...@gmail.com, Oct 8, 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 jordie%j...@gtempaccount.com, 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 klianm...@gmail.com, Nov 17, 2008

I dont know how to use it.

Could you post a more detailed installation instructions please ?

Comment by mrprope...@gmail.com, Dec 9, 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 brownoxf...@gmail.com, 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 jul...@gmail.com, 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 ela...@gmail.com, 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.r...@gmail.com, 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 project member gugakf...@gmail.com, 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.r...@gmail.com, 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 project member gugakf...@gmail.com, 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 8, 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.ar...@gmail.com, Jun 18, 2009

Couldn't get this going until I used

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

Looks nice otherwise! :)

Comment by thetri...@gmail.com, Jul 2, 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.

Comment by breza...@gmail.com, Sep 17, 2009

In order to display results by webgrind I had to let xdebug generate the profiler file names by itself by removing (commenting out) the "xdebug.profiler_output_name" value in my php.ini. That way xdebug generated it's default profiling results file names like "cachegrind.out.3200" etc. So basically thetrippy's comment was helpful because webgrind refused to read custom defined profiling results file names although WebCacheGrind? didn't have such problems.

Also I have to agree that webgrind is not well documented, especially the installation part which simply misses to explain some important parts of the installation process.

Comment by ram...@gmail.com, Sep 30, 2009

can you make install tutorial for xampp on ubuntu

Comment by zachwpa...@gmail.com, Apr 2, 2010

If you are using a .htaccess file file for custom output file-naming or a custom profile directory, (ie. not set globally in php.ini) you will need to modify the xDebugOutputFormat() function and the xdebugOutputDir() function to return the correct paths as they check the php.ini file for a value first, overriding whatever is in your Webgrind_Config?.

Comment by bruno.zi...@gmail.com, Apr 22, 2010

I've installed successfully. But there will render no files! I can't see any error. cachegrind.out... Files are there, Filerights are all ok, apache Log gives me no error! I have no Idea! In the Dropdown List "Auto (newest)" are no files to select! I spend over 2 hour! ....... Maybe there is an angel who can help me!

Comment by project member gugakf...@gmail.com, May 5, 2010

@bruno.ziegler: Have you verified that webgrind is looking in the correct directory for the cachegrind output files? Also check that the format specifier matches that of the filenames.

Comment by mlsamuelson@gmail.com, May 15, 2010

Loving Webgrind. Thank you, developers.

I've written up a Webgrind install tutorial for MAMP on OS X that includes a quick intro to the Webgrind UI.

Comment by phpla...@gmail.com, May 17, 2010

Note that you need to click the 'update' button on the top right after selecting your cachegrind fine (or leave it at Auto) from the drop down list.

Refreshing the initial page won't do anything.

I thought it wasn't working because I pressed F5 to reload the webgrind screen, but in fact it wanted me to click Update at the top right.

Comment by Tom.Maia...@gmail.com, Jun 19, 2010

Anyone get empty output files? I have cachegrind files being written where I said and when I run xdebug (i can debug and step through my php scripts as well, something like komodo ide will allow me to step in/out/over) but the files it's writing to disk are just empty (0 bytes). Any ideas? Thanks

Comment by Tom.Maia...@gmail.com, Jun 19, 2010

Got it. No sooner do I give up and ask after hours of trying do I spend another 5 minutes and get it. Seemingly just: xdebug.profiler_append=1 made it work. Now not only are the files full of data, they also have the script name rather than Unknown! (cachegrind.out.127.... Don't know why, but that made it work.

Comment by dns...@gmail.com, Jul 29, 2010

I had some experience to make webgrind show the list of files. The reason was that debugger files were located in /var/www/xdebug and webgrind was installed in /var/www/webgrind. So, the virtual host with the root /var/www/webgrind had php open_basedir restriction. To make webrind available to see the profiler output set php_admin_value open_basedir none or something like php_admin_value open_basedir "/var/www/webgrind-server:/var/www/profiler-output"

Comment by rhodust...@gmail.com, Aug 1, 2010

Ostensibly useful product rendered useless by inadequate installation information (or inadequate code?).

Comment by demon.g...@gmail.com, Sep 3, 2010

I found today that having the %s script name piece in the profiler_output_name file format mask would result in webgrind not seeing any of the cachegrind files that I verified were in my profiler_output_dir.

Comment by juanchor...@gmail.com, Oct 14, 2010

I've get it to work on a PHP 5.1.6 server w/o json_enconde. I downloaded (and required it on config.php) jsonwrapper (http://www.boutell.com/scripts/jsonwrapper.html). Hope it helps!

Comment by pauloliveiranet@gmail.com, Oct 14, 2010

This should be a great product. But the installation process is poor and only gaves you frustration. You (creator/developer) really need to provide more complete information on the installation process. Or make the installation more simple.

The all "auto-detection" process for directories and files pattern doesn't work. Googling everywhere on every forum i found something like 60 posts (per forum) with frustrated people that can't make it work.

I finally make it work, following three different tutorials and honestly... I don't known how. Great product anyway.

This is a constructive critic, i'm a developer and i kown the cost to produce a nice product (even open source).

Comment by wiran...@hotmail.my, Apr 12, 2011

If you installed WAMPP, go to php.ini At the bottom of the file you will find

xdebug? xdebug.remote_enable = off xdebug.profiler_enable = off xdebug.profiler_enable_trigger = off xdebug.profiler_output_name = cachegrind.out.%t.%p xdebug.profiler_output_dir = "c:/wamp/tmp"

Change it to this: xdebug.remote_enable = 1 xdebug.profiler_enable = 1

Hope this help a lot of you.

Comment by ooos...@gmail.com, Jun 29, 2011

To use webgrind you have to place cachegrind file into configured directory ($profilerDir) or change directory in config ;) Than you'll find your files in webgrind selector on top of page. And all you have to do now is to push "update"

Comment by ebra...@gmail.com, Jul 4, 2011

If you are seeing the xdebug output files in the file selector but are getting the dreaded "Select a cachegrind file above" message and nothing else when you click "Update" instead of the expected results then it probably means that webgrind is erroring out during the ajax call. (You can confirm this using the Console in Firebug.)

Solution that worked for me: make the webgrind and webgrind/tmp directories writable by all processes. No more ajax errors, and the selected file is parsed and displayed successfully.

Comment by 08bitum...@seecs.edu.pk, Jul 21, 2011

Hi there I am unable to select path of the file after opening the http://localhost/webgrind/ . I can select from first and dropdown. but 2nd one is not working i looks like it dose not work. when i click on dropdown button it shows Auto(newest) but i cannot chang it to my file or directory.

Comment by vbsmelya...@gmail.com, Sep 18, 2011

In WAMP 2.1 http://www.wampserver.com/ installation under Win7 (latest as of a couple days ago), I needed only to change Apache php.ini, set:

xdebug.profiler_enable = 1

Changes in php php.ini seemed to be irrelevant for me.

Comment by tcat...@gmail.com, Oct 6, 2011

Who don't any clue how to use it, then it's better to use KCacheGrind (http://kcachegrind.sf.net/) or WinCacheGrind? (http://sourceforge.net/projects/wincachegrind) instead.

Also worth to read the Xdebug documentation about profiling setup: http://www.xdebug.org/docs/profiler. Don't forget, this project is about viewing profiler data, not for profiling. So the documentation should not contain the entire profiling process.

Comment by akazadiu10@gmail.com, Jan 10, 2012

how to use it


Sign in to add a comment
Powered by Google Project Hosting