Skip to content

Instantly share code, notes, and snippets.

@stojg
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stojg/9885d8ebc504b2778d22 to your computer and use it in GitHub Desktop.
Save stojg/9885d8ebc504b2778d22 to your computer and use it in GitHub Desktop.
#!/bin/bash
apt-get update
apt-get install -y php5-dev make php-pear php5-mongo
pecl config-set preferred_state beta
pecl install xhprof
cd /var/www/mysite/www/
rm -rf xhprof
wget https://github.com/stojg/xhgui/archive/v0.4.1.tar.gz
tar xvzf v0.4.1.tar.gz
rm v0.4.1.tar.gz
mv xhgui-0.4.1/ xhprof
chmod -R 0777 /var/www/mysite/www/xhprof/cache/
cd /var/www/mysite/www/xhprof/
cat << EOF > /var/www/mysite/www/xhprof/config/config.default.php
<?php
return array(
'debug' => false,
'mode' => 'development',
'save.handler' => 'mongodb',
'db.host' => 'mongodb://10.129.0.235:27017',
'db.db' => 'xhprof',
// 'username', 'password' and 'db' (where the user is added)
'db.options' => array(),
'templates.path' => dirname(__DIR__) . '/src/templates',
'date.format' => 'Y-m-d H:i:s',
'detail.count' => 6,
'page.limit' => 25,
'profiler.enable' => true
);
EOF
printf "extension=xhprof.so\n" > /etc/php5/conf.d/90-xhprof.ini
php install.php
printf "auto_prepend_file = /var/www/mysite/www/xhprof/external/header.php\n" >> /etc/php5/conf.d/90-xhprof.ini
/etc/init.d/apache2 restart
# rm /etc/php5/conf.d/90-xhprof.ini && sudo /etc/init.d/apache2 restart
printf "extension=xhprof.so\n" > /etc/php5/conf.d/90-xhprof.ini
printf "auto_prepend_file = /var/www/mysite/www/xhprof/external/header.php\n" >> /etc/php5/conf.d/90-xhprof.ini
/etc/init.d/apache2 restart
sudo su
curl -o xhprof.sh https://gist.githubusercontent.com/stojg/9885d8ebc504b2778d22/raw/5054ba6ebf4d4101d15ac1217cb8974861eedcda/xhprof.sh
bash xhprof.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment