How to install XHProf profiler on Ubuntu

XHProf profiler is developed by Facebook and open sourced in March 2009 under the Apache 2.0 license. XHProf is a function-level hierarchical profiler, with a PHP extension (written in C) to collect the raw data, and a few PHP scripts for the reporting/UI layer.

The easiest way to get it is via the PEAR installer (package home):

install php5-common
pear channel-update pear.php.net
pecl install xhprof

Once you have XHProf installed, you should enable it. Open your /etc/php5/conf.d/xhprof.ini and add

[xhprof]
extension=xhprof.so
xhprof.output_dir="/var/tmp/xhprof"

Where /var/tmp/xhprof is the directory that will collect the profile data for each run.

Restart apache, and the XHProf extension should be enabled (check with "php -m" that this is the case).

Comments

Failed to download

Failed to download pecl/xhprof within preferred state "stable", latest release is version 0.9.3, stability "beta", use "channel://pecl.php.net/xhprof-0.9.3" to install

pecl install xhprof-beta

pecl install xhprof-beta solves your problem

Post new comment

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
To prevent automated spam submissions leave this field empty.