PHP tracer manual Installation
Datadog's Research Report: The State of Serverless Report: The State of Serverless

PHP tracer manual Installation

Before you start

Datadog strongly encourages you to install the PHP extension through the pre-built packages. If you still prefer to manually install the PHP tracer, follow the steps below.

Install from the .tar.gz archive

Download the latest .tar.gz from the release page.

From the location you downloaded the package:

$ tar -xf datadog-php-tracer.tar.gz -C /
  /opt/datadog-php/bin/post-install.sh

Next, modify the php.ini file to add the extension to the PHP runtime.

Install from source

Download the source code tar.gz or .zip file from the releases page and unzip the file. Then compile and install the extension with the commands below.

$ cd /path/to/dd-trace-php
$ phpize
$ ./configure --enable-ddtrace
$ make
$ sudo make install

Modify the INI file

Modify the php.ini configuration file to make the ddtrace extension available in the PHP runtime. To find out where the INI file is, run the following command:

$ php --ini

Configuration File (php.ini) Path: /usr/local/etc/php/7.2
Loaded Configuration File:         /usr/local/etc/php/7.2/php.ini
...

Add the following line to the php.ini file.

extension=ddtrace.so

Depending on how you manually installed the PHP tracer, you also need to add this line to the php.ini file.

# If you installed from .tar.gz
ddtrace.request_init_hook=<PATH_TO_EXTRACTED_TAR_GZ>/dd-trace-sources/bridge/dd_wrap_autoloader.php

# If you installed from source
ddtrace.request_init_hook=<PATH_TO_SOURCES>/bridge/dd_wrap_autoloader.php

After restarting the web server/PHP SAPI (e.g., $ sudo apachectl restart, $ sudo service php-fpm restart, etc.) the extension is enabled. To confirm that the extension is loaded, run:

$ php --ri=ddtrace

ddtrace

Datadog PHP tracer extension
...

Visit a tracing-enabled endpoint of your application and view the APM UI to see the traces.

Note: It might take a few minutes before traces appear in the UI.