The PHP Agent supports Zend Thread Safe (ZTS) for PHP 7.4. PHP Agent integrates with the ZTS mode, which helps to instrument multithreaded applications on PHP. This enables you to view the end-to-end business transaction flow and exit calls without breaks in correlation or end-to-end visibility.

PHP ZTS is currently supported only for Linux (64 bit).

PHP Agent Install Overview

The Getting Started Wizard in the Controller UI guides you through the configuration and installation steps for the PHP Agent. The installer uses the PHP directory specified in the PATH environment variable to determine the installation location. If you are instrumenting a PHP installation not specified in the PATH variable, you can manually configure and invoke the script installer.

The PHP Agent runs on Linux OS machines. The PHP Agent is designed for operating environments in which:

  • There is a single PHP installation
  • PHP is running in a single Apache or FPM pool
  • Standard packages are used to install PHP, Apache and/or PHP-FPM
  • No customizations are made to the PHP configuration

The PHP Agent may work in environments that do not meet all the requirements. However, you must be careful in installing and testing the PHP Agent and application in a staging environment.

Prerequisites

  • Ensure that PHP ZTS is installed.
    Before you install the AppDynamics PHP Agent, ensure that you use a supported PHP version. You can check your PHP version using the following command:
php -i
CODE
  • The PHP Agent does not work with PHP applications that are built with the enable-debug configuration option or in any build otherwise compiled with debugging symbols. To determine whether the application was built with debugging symbols, use the following command:
php -i | grep -e "Debug Build"
CODE

The expected response must be:

Debug Build => no
CODE
  • You can get the PHP Agent distribution from the AppDynamics Download Portal. Ensure to get the distribution file appropriate for your system. For all Linux distributions, use the distribution identified as PHP ZTS Agent 64-bit Linux.
  • During the installation, you must provide Controller connection settings and identifying information for this PHP node. The Getting Started Wizard guides you through this configuration, therefore if you are installing an AppDynamics Agent for the first time, it is recommended to use the
    Getting Started Wizard. For information about the Controller connection settings, see Agent-to-Controller Connections.
  • To complete the instrumentation, you need to stop and start the Apache Server. Ensure to perform the installation in a way that minimizes disruption to service users, if applicable.

Do not install the PHP Agent along with other non-AppDynamics Application Performance Management (APM) tools, especially in a production environment. The PHP Agent installation may fail if there are other APM products installed in the same managed environment.

Install PHP Agent with ZTS

The following topics provide installation details for various scenarios:

For cURL installation, see Download AppDynamics Software.

Files Added Post the PHP ZTS Install

The following files are added after installing the PHP Agent:

  • Configuration files

For AppDynamics, the two PHP configuration files are: php.ini and appdynamics_agent.ini fragment. AppDynamics settings can be found in either of the .ini files, depending on the operating system under which your PHP is installed. The PHP Agent installer adds the appdynamics_agent.ini file to the directory that contains your php.ini file. You can find this directory using the following command:

php -i | grep -e "Additional .ini files parsed"
CODE

If the installer is not able to determine the directory where the ini fragments for your PHP deployment exist, it displays the required AppDynamics ini fragment and prompts you to copy and paste it into your main php.ini file. Also, see http://php.net/manual/en/configuration.file.php for information about the possible locations for the configuration file.

  • .so files

The installer also installs the appdynamics_agent.so file in your PHP extensions directory. You can find this directory using the following command:

php -i | grep extension_dir
CODE
  • Logs

For each application, there is an agent log and a proxy log. By default, the agent log is written to $<php_agent_install>/logs/agent.log. The log contains the transactions that the agent processes and then sends to the proxy. The default pattern for agent log naming is:

  • agent.log: the current log
  • agent.log.1: most recent log
  • agent.log.2: second most recent log
  • agent.log.3: third most recent log
  • agent.log.4: fourth most recent log
  • agent.log.5: fifth recent log

You can find the licenses of the third-party libraries under the directory license in the agent installation folder: appdynamics-php-zts-agent-linux_x64/license.

Install a Machine Agent on a PHP Node

You can install a Machine Agent on a node that runs the PHP Agent. However, if you install the Machine Agent on a PHP Agent node and you specify the tier and node name in the controller-info.xml file of the Machine Agent, the PHP Agent does not successfully register with the Controller.

To avoid this:

  • Install the PHP Agent before you install the Machine Agent
  • If you install the Machine Agent on the machine hosting the instrumented PHP node, do not specify the application, tier or node name in the controller-info.xml file of the Machine Agent. If you do, the PHP Agent may fail to register.