I am trying to get XHProf to work, but though I get the link at the bottom of the page clicking it throws a "Page Not found error". Searching the Drupal documentation, I landed on a page for configuring XHProf for Nginx. reading through the comment thread (there were several comments on what to do for Apache) I managed to get only this far

On my Ubuntu 12.04 laptop I've installed D6 (actually pressflow 6.x). I have several D6 vhosts on my machine. I installed XHProf using PECL ()

Add the newly created xhprof extension to my php.ini file at /etc/php5/apache2/php.ini

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

Restarted Apache and cheked if the XHProf is running

apachectl restart
php -m | grep xhprof

(Found that XHProf is running)

Checked PHP Info to make sure XHPRof is running.

In the Devel module settings, I enabled

[ ] Enable profiling of all page views and drush requests.
xhprof directory: /usr/share/php
XHProf URL: http://zen/xhprof_html

To enable access to the url through a browser I created a virtual host with the following entries

<VirtualHost *:80>
        ServerAdmin myname@mymail.com
        #ServerName xhprof
        DocumentRoot /home/sridhar/mydocumentroot
        Alias /xhprof_html /usr/share/php/xhprof_html
        <Directory /usr/share/php/xhprof_html/ >
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

I then created a sym link in my drupal document root
ln -s /usr/share/php/xhprof_html xhprof

Though I see the XHProf output link at the bottom of the page clicking it throws a page not found error. It points to

http://localhost/xhprof_html/index.php?run=5124d5227a9f5&source=mysitename

Been trying to get my hands on some documentation that will ease the pain, but haven't been lucky. Would appreciate any inputs to get this working.

Comments

sridharpandu’s picture

Oh no responses, I expected some one to throw some light on this :-(

Acer Aspire 5745
[i5 430M, 3GB, 320GB]
Ubuntu 12.04 (Precise Pangolin)
Drupal 6.15, 7.x
DigitalOcean, Go Daddy, Rackspace,

kannan@kiluvai.com’s picture

I assume this is something related to your tmp folder write permission, xhprof would not able to write to your tmp directory. please check the documentation and give proper write permission for the tmp directory for writing by php.

Normally create a subfolder inside the tmp folder as 'xhprof' and change ownership of the created directory to avoid permission problems
sudo chown www-data xhprof/ -R
now change the xhprof.ini as
xhprof.output_dir="/tmp/xhprof"
restart your apache

sridharpandu’s picture

You were right I missed providing the write permissions. So took your suggestion and created a directory within tmp. Now I see the files being generated. But the link at the bottom of the page stills throws a page not found error.

I checked if my sym link from my drupal root to the xhprof_html directory is available and it is available with the following permissions

lrwxrwxrwx 1 root root 26 Feb 20 18:46 xhprof -> /usr/share/php/xhprof_html

Just not able to figure out why on earth it throws the page not found error.

Acer Aspire 5745
[i5 430M, 3GB, 320GB]
Ubuntu 12.04 (Precise Pangolin)
Drupal 6.15, 7.x
DigitalOcean, Go Daddy, Rackspace,

kannan@kiluvai.com’s picture

I then created a sym link in my drupal document root
ln -s /usr/share/php/xhprof_html xhprof

Though I see the XHProf output link at the bottom of the page clicking it throws a page not found error. It points to

http://localhost/xhprof_html/index.php?run=5124d5227a9f5&source=mysitename

From your post, i have noticed, that you have created sym link label as "xhprof", but in your URL you are mentioning xhprof_html, actually your url must be http://localhost/xhprof not http://localhost/xhprof_html

try this :)

sridharpandu’s picture

Thanks a lot for point out. Just a simple mistake was making me going around in circles. It works now. Thanks once again.

Acer Aspire 5745
[i5 430M, 3GB, 320GB]
Ubuntu 12.04 (Precise Pangolin)
Drupal 6.15, 7.x
DigitalOcean, Go Daddy, Rackspace,

alexmoreno’s picture

jfi, the combination of xdebug and webgrind is really easy to install, and the results (data generated) are the same.

At least installing xhprof for me was a pain, and xdebug very straightforward.