Skip to content

Instantly share code, notes, and snippets.

@sachitsac
Created November 29, 2013 13:31
Show Gist options
  • Save sachitsac/7705722 to your computer and use it in GitHub Desktop.
Save sachitsac/7705722 to your computer and use it in GitHub Desktop.
Install Xhprof on ubuntu 12.04 and enable the web interface using an alias /profiling
#!/bin/bash
sudo apt-get install php-pear
sudo pear upgrade pear
sudo pecl install xhprof-beta
sudo apt-get install graphviz
sudo cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini_original
sudo cp /etc/php5/apache2/php.ini /tmp
echo "#Enable XHPROF Extension" >> /tmp/php.ini
echo "extension=xhprof.so" >> /tmp/php.ini
sudo chown $USER /tmp/php.ini
sudo chmod 775 /tmp/php.ini
sudo cp /tmp/php.ini /etc/php5/apache2/
sudo service apache2 restart
# Add xhprof to apache
touch /tmp/profiling
echo "Alias /profiling /usr/share/php/xhprof_html" >> /tmp/profiling
echo "<Directory /usr/share/php/xhprof_html/>" >> /tmp/profiling
echo "Options +Indexes +FollowSymLinks" >> /tmp/profiling
echo "AllowOverride None" >> /tmp/profiling
echo "order allow,deny" >> /tmp/profiling
echo "allow from all" >> /tmp/profiling
echo "</Directory>" >> /tmp/profiling
sudo mv /tmp/profiling /etc/apache2/sites-available/
sudo a2ensite profiling
sudo service apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment