Installing and XHProf to profile Drupal on Ubuntu
The following recipe was used to install XHProf on a Ubuntu server running Drupal 6, inspired by http://techportal.ibuildings.com/2009/12/01/profiling-with-xhprof/ – my PEAR installer complained about missing config.m4, and I couldn’t find Brian Mercer’s php5-xhprof Ubuntu package.
Download and manually install XHProf:
wget http://pecl.php.net/get/xhprof-0.9.2.tgz
tar xvf xhprof-0.9.2.tgz
cd ./xhprof-0.9.2/extension/
phpize
./configure --with-php-config=/usr/bin/php-config
make
make install
make test
cd ..
cp -rp xhprof_html /usr/share/php/
cp -rp xhprof_lib /usr/share/php/
mkdir /var/tmp/xhprof
chown www-data /var/tmp/xhprof
Optional – install graphviz for the Callgraph funtionality
apt-get install graphviz
Create /etc/php5/conf.d/xhprof.ini
[xhprof]
extension=xhprof.so
xhprof.output_dir="/var/tmp/xhprof"
Create/etc/apache2/conf.d/xhprof.conf
alias /xhprof_html "/usr/share/php/xhprof_html/"
Restart Apache
apache2ctl graceful
Configure Drupal in /admin/settings/devel
xhprof directory: /usr/share/php
xhprof URL: /xhprof_html
Now to get my head around what it all means!








