Skip to content

Instantly share code, notes, and snippets.

@snoek09
Last active July 13, 2017 08:43
Show Gist options
  • Save snoek09/72d0563d350fcc9ea6117790eeb6e60f to your computer and use it in GitHub Desktop.
Save snoek09/72d0563d350fcc9ea6117790eeb6e60f to your computer and use it in GitHub Desktop.
install XHProf fork (Tideways) on Ubuntu

all instructions for php 7.0

install XHProf fork (Tideways) on ubuntu

$ sudo nano  /etc/apt/sources.list.d/tideways.list

deb http://s3-eu-west-1.amazonaws.com/qafoo-profiler/packages debian main

$ wget -qO - https://s3-eu-west-1.amazonaws.com/qafoo-profiler/packages/EEB5E8F4.gpg | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install tideways-daemon tideways-php tideways-cli

install mongoDB and php extension

$ sudo apt-get install mongodb php7.0-mongodb
$ php --ri mongodb

setup indexes

$ mongo

use xhprof
db.results.ensureIndex( { 'meta.SERVER.REQUEST_TIME' : -1 } )
db.results.ensureIndex( { 'profile.main().wt' : -1 } )
db.results.ensureIndex( { 'profile.main().mu' : -1 } )
db.results.ensureIndex( { 'profile.main().cpu' : -1 } )
db.results.ensureIndex( { 'meta.url' : 1 } )
exit

install XHGui

$ sudo mkdir -p /var/www/xhgui
$ sudo chown -R werkspot.www-data /var/www/xhgui
$ cd /var/www
$ git clone https://github.com/perftools/xhgui.git xhgui
$ cd xhgui
$ php install.php

setup virtual host

$ sudo nano /etc/nginx/sites-available/xhgui
server {
    listen   80;
    server_name xhgui1.testing2.werkspot.com;
    root   /var/www/xhgui/webroot/;
    index  index.php;

    location / {
        try_files $uri $uri/ /index.php?$uri&$args;
    }

    location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
    }

    error_log /var/log/nginx/xhgui.error.log;
}
$ sudo ln -s /etc/nginx/sites-available/xhgui /etc/nginx/sites-enabled/xhgui
$ sudo service nginx restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment