Standalone PHP Agent configuration

When PHP runs in FPM mode, served for example by NGINX or without activating a Web Server Agent in general, you can use the PHP monitoring features, but you need to perform a special installation procedure.

Prior to installation

Obtain the Web Server Agent installation package by adding a PHP application tier in your monitoring System Profile. Transfer the package to your Server and unpack it in a Linux FHS compliant directory (for example, /opt/dynatrace-7.0). Ensure that the dtwsagent.ini file contains correct values for the Agent name and the AppMon Server address. See Web Server Agent Configuration for more information on allowed values for configuration directives.

Make sure you know where the php.ini file is located. This depends on your Linux distribution and installation method (packages or from source).

Installation

To deploy PHP monitoring, you need to edit the php.ini file and enable the automatic start of the AppMon Agent manually.

extension=<agentPath>

On a 64-bit Linux platform and PHP 5.4, add the following line:

extension=/opt/dynatrace-<major.minorVersion>/agent/lib64/libdtagent.so

Note

Add the directive at the bottom of php.ini file. The agent should be the last loaded extension.

You can use the dynaTraceWebServerAgent script to have Agent started each time your system boots. This script is available in your AppMon Agent installation directory, <agentPath>/init.d/dynaTraceWebServerAgent (for example, /opt/dynatrace-7.0/init.d/dynaTraceWebServerAgent). This way no manual Agent start is necessary when your system is restarted.

By default, the Agent is set to start in runlevel 3 and 5. Default settings make Agent stop in runlevels 0, 1, 2, and 6. For example, to start the Agent also in runlevel 2, edit the script as follows:

# Default-Start: 2 3 5
# Default-Stop: 0 1 6

You can also edit the /etc/rc.local script and add <agentPath>/init.d/dynaTraceWebServerAgent start there instead of using distribution tools.

Execute /etc/init.d/dynaTraceWebServerAgent start to start the AppMon Agent manually.

Execute ps -ef | grep dtwsagent to find the agent process and verify the agent properly loads.

ps -ef |grep dtwsagent
root     18290     1  0 15:35 pts/0    00:00:02 /opt/dynatrace-<major.minorVersion>/agent/lib64/dtwsagent server=localhost

You can also verify Agent communication with the AppMon Server using Agents Overview in the AppMon Client.

phpinfo() also contains information about AppMon Agent. The section dtphpagent contains information about agent version, status (enabled, not enabled), and the path to the log file.

Restart your web server. You may also need to restart your php-fpm daemon.