XHProf for PHP7 and PHP8

Self-hosted XHProf (free & opensource)

The original XHProf extension recently found new maintainers and adds PHP 7 & 8 support based on a completely rewritten code-base for less overhead.

You can install xhprof PHP Extension by compiling it from its open-source codes or from a package in your distribution. Head over to the Github repository and download the source from there. You can install the extension using these steps:

git clone "https://github.com/longxinH/xhprof.git"
cd xhprof/extension
sudo make install

Load the extension in your php.ini with extension=xhprof.so.

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


// your application code

$data = xhprof_disable();
    sys_get_temp_dir() . "/" . uniqid() . ".yourapp.xhprof",

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.

Try Tideways PHP Profiler 30 days for free

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

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

The cloud version of Tideways includes SQL Query, HTTP, Framework + E-Commerce Profiling, and many additional features that XHProf does not.