PHP Agent configuration

Overview

PurePath technology provides full visibility into PHP application performance and behavior: From a browser click to the database and back, for all transactions, in real time 24x7. Smart auto-detection of PHP pages lets you see which page has performance issues. The core of the solution is the instrumentation of an Agent for the Apache HTTP server PHP extension.

AppMon has extensions to instrument PHP on Windows, either in combination with the Apache HTTP Server or IIS.

The following table lists the supported PHP versions by operating system.

Operating system PHP 5.3 PHP 5.4 PHP 5.5 PHP 5.6 PHP 7.0 PHP 7.1 5
Windows (x86) Check 1,3 Check 1,3 Check 1,3 Check 1,3 Cross Cross
Linux (x86/x64) Check 1,2,3 Check 1,2,3 Check 1,2,3 Check 1,2,3 Check 1,2,3,4 Check 1,2,3,4,5

1 mod_php (for Apache Web Server) and PHP CGI (for IIS).
2 PHP FPM (fast process manager; for Nginx)
3 PHP threaded MPM is not supported as it is not production setup safe. (reason: PHP_TS)
4 Supported only with PHP OneAgent
5 As of 7.0.3

Supported PHP flavors include:

  • PHP Zend Engine
  • PHP FastCGI
  • PHP-FPM
  • suPHP

Architecture

Web servers like the Apache HTTP Server typically consist of several worker processes that handle different requests. Sometimes the processes contain several threads or one process is created for each request. Since the lifetime of worker processes is not known in advance, the AppMon Agent for web servers consists of the following parts:

  • The PHP interpreter loads the extension. It gathers the information the AppMon Server uses for analysis.
  • The Web Server Master Agent is a separate process that collects all worker process data. It handles communication with the Collector, retrieves configuration data, and performs other functions.
  • Start the Web Server Master Agent on Linux separately as a daemon (like the service on Windows) and not with the sub-Agent. See Web Server Agent Configuration.

The PHP Agent communicates with the Web Server Master Agent through these channels:

  • The shared memory segment propagates configuration data to the worker processes that the Web Server Master Agent receives from the collector, and holds other information shared across all worker processes. The shared memory segment is backed by a file on all platforms. The worker processes and the Master Agent process must have read/write access. This file is located in <dynatrace install dir>/agent/conf.
  • The PHP Agent sends collected data to the Web Server Master Agent through a stateless UDP connection. The Master Agent collects this data, transforms it, and forwards it to the AppMon Collector.

Install, configure and verify

Install, configure and start the Web Server Master Agent service / daemon. You need to at least configure the Agent name in <dynatrace install dir>/agent/conf/dtwsagent.ini that matches the mapping in your active System Profile. See Web Server Agent Configuration and Apache Web Server Agent Configuration for more information.

At the bottom of the php.ini file (or at least as last extension) add a reference to PHP Agent extension. The revision is not a part of the default installation path, so the version portion is 7.0 and not 7.0.0. A 64-bit Agent example for an AppMon default installation is as follows:

extension=/opt/dynatrace-7.0/agent/lib64/libdtagent.so

A 32-bit Agent example for an AppMon default installation on Windows in combination with Apache or IIS is as follows: extension="C:\Program Files\dynaTrace\dynaTrace7.0\agent\lib\dtagent.dll" php.ini

This is typically is in xampp\php for XAMPP or C:\Program Files (x86)\PHP\v<major.minorVersion> when installed with the Web Platform Installer.

The bootstrapper (libdtagent.so for *NIX or dtagent.dll for Windows) chooses the right PHP extension for the PHP version in use and threadsafe (_ts) or not. (dtphpagent<majorMinorPHPversion>[_ts].so or.dll)

Regardless of the PHP distribution you deploy, the AppMon Agent start always triggers in the php.ini file. The php-fpm.conf file is not supported.

  • Resort to the System Information dashboard or directly to the logs in <dynatrace install dir>/log if needed.
  • The dtphpagent section in phpinfo() contains information as well, including Agent version, status (enabled or not) and the path to the log file. See the Apache sample page in a web browser so see this information.

Limitations

Reserved PHP keywords

AppMon does not support PHP reserved keywords instrumentation. See the PHP website for a complete list of keywords.

Include or require nodes in a PurePath do not refer to any PHP keywords, and have different meaning than the PHP keywords. They refer to the code in the PHP files, and not to the files. For example, if the PurePath shows the execution time for an include node, it shows how much time it took to process the code included in the files.

The only exception to this rule are the die() and exit() keywords, for which AppMon can report an exception, but only if the keyword occurs inside a function body.

Unsupported functions

  • curl_setopt: The curl_setopt function calls are suppressed to keep the PurePath size small with the PHP cURL sensor. The limitation applies also to user-defined sensor rules. See PHP documentation for information about the function.

Capture default PHP argument

AppMon does not support default PHP arguments capture.

Accelerators

If you use PHP accelerator extensions in your PHP deployment, like eAccelerator, it does not report compilation time.

OneAgent usage

If you're using OneAgent, don't forget to configure ports for it.

Be aware that:

  • Not all features/sensors available in Classic Agent are already available in the OneAgent for AppMon
  • Features/Sensors known from Classic Agent can behave differently
  • Some features may be still in development

Rollout

To use OneAgent in AppMon 2017 May, install Classic Agents first then roll them out to the OneAgent. No additional configuration needed. Before you switch to OneAgent, double check your major requirements with the available feature set.