Skip to content
claytonrcarter edited this page Jan 30, 2019 · 6 revisions

Instructions for installing webgrind

Requirements

To run Webgrind you need a web server 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. 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.

Installation

  1. Download Webgrind.
  2. Extract Webgrind to a folder accessible to the web server.
  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.

Configure Call Graph

The call graph makes use of jrfonseca/gprof2dot, which requires both graphviz and python (2.7+ or 3.3+). The gprof2dot project provides installation instructions.

Depending on your platform and installed versions, you may also have to update config.php with the installed locations for dot and python. (eg, python 3 may be installed as python3 or dot may be in a different location in older Ubuntu versions.)

    /**
     * Path to python executable
     */
    static $pythonExecutable = '/usr/bin/python';

    /**
     * Path to graphviz dot executable
     */
    static $dotExecutable = '/usr/bin/dot';