Profiling PHP Applications with Tideways XHProf and XHGui

This article focuses on how to profile PHP applications with Tideways XHProf and XHGui. I myself prefer this approach than the old XDebug and Webgrind so most of my recent projects have been utilizing this. Since this is just simply a note, Google is your friend for the mentioned tools.

0. Install PHP 7.2 FPM (with Nginx, and CLI) as usual

1. Install MongoDB and PHP MongoDB extension

Remember that we need MongoDB version >= 3.0 for XHGui, so we cannot use the built-in Ubuntu 16.04 mongodb package.


2. Install Tideways XHProf extensions

3. Install XHGui

  1. Download and install dependencies:
  2. Setup Nginx virtual host for XHGui:

    Now we can access the XHGui web interface via
  3. Enabling Profiling in our App: we are going to include the xhgui/external/header.php file to our web app.
    • We can simply do it by adding the following directive to the PHP block of the corresponding web app:
    • Then, restart Nginx and we are good to go.
  4. Done, you can access the XHGui now. Remember that XHGui only profiles 1 out of 100 requests received, so you need to put enough load and actions on the target website ( to have the result in XHGui.


Leave a Reply