This page provides an overview of AppDynamics PHP Agent installation. 

Installation Overview

In the Controller UI, the Getting Started Wizard walks you through the configuration and installation steps for the PHP Agent.

The installer that you get from the wizard uses the PHP directory specified in your environment PATH variable to determine where to install the agent. If you are instrumenting a PHP installation not specified in your PATH, you can manually configure and invoke the RPM or script installer. 

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

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

The PHP Agent may work in environments that do not meet all assumptions. However, you should use extra care in installing and thoroughly testing the PHP agent and application in a staging environment. 

Before Starting

Before attempting to install the AppDynamics PHP Agent, confirm that you use a supported PHP version. You can check your PHP version using this command:

php -i


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, you can use this command:

php -i | grep -e "Debug Build"

The response should be:

Debug Build => no

You can get the PHP Agent distribution from the AppDynamics Download Portal. Be sure to get the distribution file appropriate for your system:

  • For RedHat or CentOS, use the RPM Package Manager distribution, such as PHP Agent—64-bit RPM.
  • For all other Linux distributions, use the distribution identified PHP Agent—64-bit Linux. 
  • For MacOS, use PHP Agent—64-bit OSX

At installation time, you will need to provide Controller connection settings and identifying information for this PHP node. The Getting Started Wizard walks you through this configuration, so if it is your first time installing an AppDynamics Agent, we recommend using the Getting Started Wizard. For general information about the Controller connection settings, see Agent-to-Controller Connections.

To complete the instrumentation, you will need to stop and start the Apache Server. Be sure 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.

Installing the PHP Agent

These topics provide installation details for various scenarios:

For cURL installation, see Download AppDynamics Software.

Files Added by Installation

PHP configuration files

For AppDynamics, the PHP configuration files of interest are the php.ini and appdynamics_agent.ini fragment. AppDynamics settings can be found in either .ini file, 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"

If the installer is not able to determine the directory where the ini fragments for your PHP deployment live, 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 possible locations.

.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

Logs

There is an agent log and a proxy log for each application.

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

By default, the proxy log is written to $<php_agent_install>/logs/proxy_$date.log. This log contains the transactions that the proxy accepts from the agent and then sends to the Controller.

If you configure the logs directory with the --log-dir option, the proxy logs are written to the same directory as the agent logs.

For information about the location of log files generated by an RPM installation, see RPM Log file in Install the PHP Agent by RPM.

Using a Machine Agent on a PHP Node

You can install a machine agent on a node that runs the PHP Agent. However, note that 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 will not successfully register with the Controller.

To avoid this problem:

  • 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.