Tideways is a modern fork of XHProf for PHP 5 and PHP 7

The PHP Profiling Extension XHProf was released by Facebook in 2009 in combination with a very simple UI. It was built for profiling production traffic. Today it is unmaintained because Facebook now runs on HHVM and not on Zend's PHP anymore.

Tideways Profiler started as a fork of XHProf originally and the extension is still distributed as open-source project on Github.

The following changes have been made to the hierachical profiler feature:

  • Support for PHP 7.0, 7.1, 5.6 and 5.5 (fixed segfaults).
  • Increased performance and timestamp reliability on Linux.
  • No collection of require/include calls anymore as they only bloat the output and are not of much relevance in modern PHP applications.
  • Add support to profile only builtin functions with TIDEWAYS_FLAGS_NO_USERLAND flag.
  • Add support to profile only a selected list of functions with $options['functions'] key.
  • Renamed functions but kept API similar. Extension is not a drop-in replacement, but data-format is still 100% compatible with XHProf.

Installation of Tideways PHP extension

You can install Tideways PHP Extension in various ways, it is not necessary to have an account for the Tideways product.

We recommend to use our pre-compiled packages for Debian, Ubuntu, CentOS, RHEL and MacOS. You can find them on the downloads page.

If you want to compile the extension yourself you can head over to the Github repository and download the source from there. You can install the extension using the usual steps:

$ git clone https://github.com/tideways/php-profiler-extension.git
$ cd php-profiler-extension
$ phpize
$ ./configure
$ make
$ sudo make install

As for integration of Tideways into your application you can use the low-level API to enable and disable the Profiler, much like XHProf worked:

<?php
tideways_enable(TIDEWAYS_FLAGS_NO_SPANS);

// your application code

$data = tideways_disable();
file_put_contents(
    sys_get_temp_dir() . "/" . uniqid() . ".yourapp.xhprof",
    serialize($data)
);

This stores the trace in your temporary directory which the default UI uses to look for data. Install the xhprof_lib and xhprof_html directories from this repository into your webfolder and navigate to xhprof_html/index.php to see a list of trace.

If you want to use some improved open-source UIs take a look at the following projects:

Please check each projects installation notes on how to get the respective UIs running.

If you want to avoid the manual setup, integration and maintenance you should give Tideways Profiler UI a try. We take care of efficient collection, aggregation and provide a snappy, modern UI combined with tons of features such as Alerting on top.

Try Tideways Profiler UI for free

We have built a new intuitive and modern UI around XHProf and enhanced it with additional features that allow you to keep the performance of your PHP application under control around the clock.

You can try the Tideways Profiler UI 30 days for free, no credit-card required: