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
pecl install xhprof

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


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).


Failed to download

Failed to download pecl/xhprof within preferred state "stable", latest release is version 0.9.3, stability "beta", use "channel://" 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> <pre>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <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.

More information about formatting options

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.