User Tools

Site Tools


Tideways (XHProf alternative) Setup using Debian 8 and PHP 7

Dec 2016

1. Install PHP7 on Debian8

1.1. Add new sources to Debian

    sudo vim /etc/apt/sources.list

    # Dotdeb repository
    deb jessie all
    deb-src jessie all

1.2. Get and Install GnuPG key

    sudo apt-key add dotdeb.gpg

1.3. Update packages and install

    sudo apt-get update
    sudo apt-get install php7.0 php7.0-common

1.4. Apache2

    sudo apt-get install libapache2-mod-php7.0
    sudo service apache2 restart

1.5. Install extra packages

    sudo apt-cache search php7

2. Install MongoDB

2.1. Install Mongo server

    sudo apt-get install mongodb

2.2. Install Mongo Driver

    sudo apt-get install php7.0-mongodb

2.3. Start it up

    sudo service mongodb start

If it complains about the needed space (check /var/log/mongodb/mongodb.log) you can use smallfiles options. In /etc/mongodb.conf add:


3. Install Tideways

3.1 Installation

    sudo apt-get install tideways-php tideways-daemon tideways-cli

3.2. PHP configuration

In your php.ini append this:

4. XHGui

4.1. Installation

Somewhere in your webserver folder, for example:

    git clone xhgui

Set the permissions on the cache directory to allow the webserver to create files.

    cd xhgui
    php install.php

4.2. Apache configuration

Create a new file /etc/apache2/sites-available/002-xhgui.conf

<VirtualHost *:80>
        ServerName xhgui.debian
        DocumentRoot "/var/www/html/xhgui/webroot"

        <Directory /var/www/html/xhgui/webroot>
            Options Indexes FollowSymLinks
            AllowOverride FileInfo
            Require all granted

Create a symbolic link in sites-enabled:

    ln -s /etc/apache2/sites-available/002-xhgui.conf /etc/apache2/sites-enabled/

Note: for apache 2.4 you have to append .conf extension to your files.

Also, in /etc/php/7.0/apache2/php.ini add this line:

    auto_prepend_file = "/var/www/html/xhgui/external/header.php"

Restart apache afterwards.

4.3. Configure XHGui


'profiler.enable' => function() {
        $url = $_SERVER['REQUEST_URI'];
        return (strpos($url, 'xhgui') !== false);

5. Profiling

Once everything is setup, and you have an working xhgui instance, you can do your profiling appending xhgui keyword to your URLs:

e.g. https://my.application/users?xhgui

Then http://xhgui.debian// will show the runs.

php/tideways.txt · Last modified: 2016/12/05 10:49 by admin