Thursday, April 02, 2015

Profiling Drupal with XHProf In Ubuntu

sudo apt-get install php5-dev graphviz

cd /var/www/
mkdir xhprof
cd xhprof/
wget https://github.com/facebook/xhprof/archive/master.zip
unzip master.zip
cd xhprof-master/extension/
phpize
./configure
make
sudo make install
libtool --finish modules/

sudo touch /etc/php5/apache2/conf.d/20-xhprof.ini
sudo subl /etc/php5/apache2/conf.d/20-xhprof.ini

[xhprof]
extension=xhprof.so
xhprof.output_dir="/var/www/xhprof"

cd /etc/apache2/sites-available/
touch xhprof.dev.conf
sudo subl xhprof.dev.conf


    ServerName xhprof.dev

    ServerAdmin jewei@localhost
    DocumentRoot /var/www/xhprof/xhprof-master/xhprof_html

    LogLevel error

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined


sudo a2ensite xhprof.dev.conf
sudo service apache2 restart

sudo subl /etc/hosts

127.0.0.1 xhprof.dev

1. Goto /admin/config/development/devel.
2. Enable profiling of all page views and drush requests.
xhprof directory: /var/www/xhprof/xhprof-master
XHProf URL: http://xhprof.dev

No comments: