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

Tags:

Comments

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 solves your problem

Add new comment

Filtered HTML

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
To