Installing and XHProf to profile Drupal on Ubuntu

Filed under: drupal,web development — jaydublu @ 2:48 pm

The following recipe was used to install XHProf on a Ubuntu server running Drupal 6, inspired by – 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:

tar xvf xhprof-0.9.2.tgz
cd ./xhprof-0.9.2/extension/
./configure --with-php-config=/usr/bin/php-config
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



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!

How to liven up a dull blog

Filed under: opinion — jaydublu @ 2:00 pm

WinCacheGrindPerformance problems again, but this time at an application level. So I finally get around to trying out PHP profiling tools in earnest. XDebug and WinCacheGrind give very useful information where a script is spending its time, without having to go dropping bits of benchmarking code around.

I know this is old news – I’ve just not had a real need before now. So I go hunting for good info on how to get the most from WinCacheGrind, and the project’s SourceForge homepage has a really interesting approach to livening up what could otherwise be a slightly dry geeky subject.

Not an approach I would feel adopting long term, but I thought I might try it out just once…