Enabling the PHP Profiler
Requirements
For a summary of the minimum and recommended runtime and tracer versions across all languages, read Supported Language and Tracer Versions.
The Datadog Profiler requires at least PHP 7.1, on 64-bit Linux.
PHP ZTS builds are supported since dd-trace-php
version 0.99+, while PHP debug builds are not supported.
An operating system with glibc 2.17 or newer is required. The following versions or newer meet this requirement:
- CentOS 7.
- Debian 8, which has reached end of life (EOL).
- Ubuntu 14.04, which is EOL.
Datadog recommends running an OS version that is not EOL.
Version 3.13 or newer of Alpine Linux is required because the profiler is built against musl v1.2.
Additionally you need to install libgcc_s
with:
The following profiling features are available in the following minimum versions of the dd-trace-php
library:
Continuous Profiler is not supported on some serverless platforms, such as AWS Lambda.
Installation
To begin profiling applications:
Ensure Datadog Agent v6+ is installed and running. Datadog recommends using Datadog Agent v7+.
Download the datadog-setup.php
script from the GitHub release page. Version 0.69.0 is the first tracer release to include this installer.
Run the installer to install both the tracer and profiler, for example php datadog-setup.php --enable-profiling
. This script is interactive and asks which of the detected PHP locations it should install to. At the end of the script, it outputs the non-interactive version of the command arguments for future use.
Configure the profiler using config mode through the datadog-setup.php
:
# `datadog.profiling.enabled` is not required for v0.82.0+.
php datadog-setup.php config set -d datadog.profiling.enabled=1
php datadog-setup.php config set \
-d datadog.service=app-name \
-d datadog.env=prod \
-d datadog.version=1.3.2
php hello.php
Apache, PHP-FPM and other servers require a restart after changing the INI
settings.
See the configuration docs for more INI settings.
A minute or two after receiving a request, profiles appear on the APM > Profiler page.
Not sure what to do next?
The Getting Started with Profiler guide takes a sample service with a performance problem and shows you how to use Continuous Profiler to understand and fix the problem.
Further Reading
Additional helpful documentation, links, and articles: