AppDynamics Application Intelligence Platform

3.9.x Documentation


Learn by Watching

Doc Maps

Skip to end of metadata
Go to start of metadata

Watch an AppDynamics engineer install the PHP Agent in this AppDynamics in Action video:

Installing the PHP Agent

To install the PHP Agent

1. Untar the tarball containing the agent into a directory. The directory should be owned by the same user that runs Apache or php-fpm. AppDynamics recommends /opt/appdynamics/php-agent.

This documentation refers to this directory as the php_agent_install directory or $<php_agent_install>.

cd $<php_agent_install>
tar -xvjf appdynamics-php-agent-x64-linux.tar.bz2

2. Set the following permissions on these subdirectories of your php_agent_install directory.

  • logs - Make the logs directory readable/writable/executable by all. 

    chmod 777 <php_agent_install>/logs
  • php - Make every directory that leads to the PHP agent logs directory readable and executable by all and writable by the directory owner.

    chmod -R 755 <path_to_php_agent_install_logs>

3. Run the installation script using the following syntax. Each PHP instance is a single node.

$<php_agent_install>/  [-s] [-a=<account_name>@<account_key>]
[--http-proxy-host=<proxy_host>] [--http-proxy-port=<proxy_port>] [-e <php_ext_dir>] [-i <php_ini_dir>]
[-p <php_binary_dir>] [-v <php_version>]
 <controller-host> <controller-port> <app_name> <tier_name> <node_name>
  • -s option: You can optionally specify the -s option if you want the agent to use SSL (HTTPS) to connect to the controller. In this case, set the Controller port to the HTTPS port of the controller.
  • account_key and_account name: The AppDynamics account_key and account_name are required for a controller running in multi-tenant mode. These values are provided in your welcome email from AppDynamics.
  • http-proxy-host:
  • http-proxy-port:
  • http-proxy-user:
  • http-proxy-password-file:

Set the http-proxy-host and http-proxy-port to route data to the controller through a proxy server. The http-proxy-host is the host name or IP address of the proxy server. The http-proxy-port is the proxy server's HTTP or HTTPS port, whichever you are using. If you set the http-proxy-host you must set the http-proxy-port as well.

Use the http-proxy-user and http-proxy-port if the proxy server requires credentials.

  • -e option: extensions directory for the file; needed only when the default PHP CLI binary cannot be determined.
  • -i option: ini directory for the appdynamics_agent.ini file; needed only when the default PHP CLI binary cannot be determined.
  • -v option: version of PHP that you are instrumenting. Valid formats are version numbers to one or two decimal positions; e.g. "5.4" and "5.4.21" are both valid. Needed only when the default PHP CLI binary cannot be determined or there is no PHP CLI binary.
  • -p option: path to the PHP binary

By default the installer uses the PHP CLI binary to determine where to install the PHP Agent. This works for most PHP environments.

If you are instrumenting a different PHP, use the -e option to indicate the correct extensions directory for the file and the -i option for the correct ini directory for the appdynamics_agent.ini file. If you are installing in an environment where there is no PHP CLI binary available, you must use the -v option as well as the -e, and -options.

If all options are used, the  -e, -i and -v options have precedence over the -p option.

Installing as root

On some systems, such as Ubuntu, it is necessary to perform the installation as root. Verify whether you need to install as root in your environment.

You can use sudo to do this. See


4. Restart the web server, unless you are installing an agent to monitor PHP-CLI only.

If you are running multiple installations of Apache on the same machine, run once for each Apache, each time with the appropriate node, php_ini dir and php_ext dir options. In this case see also Run the PHP Proxy Daemon Manually.

See Files Added to Your Installation for information about the default installation directories.

If your installation failed, see Resolve Installation Issues for PHP.

Installation Samples

Here is a sample command to install the agent on a single-tenant controller: controller 8090 myApp myTier myNode

Here is a sample command to install the agent using SSL on a multi-tenant on-premise controller: -s -a=PHPCust1000@9456d222-66e2-54d2-f8aabbc66c4e 8818 myApp myTier myNode

Here is a sample command to route traffic to the controller through a proxy server. --http-proxy-host=myproxyhost --http-proxy-port=8099 controller 8090 myApp myTier myNode

Tip: The installer overwrites your existing settings in the AppDynamics PHP Agent ini fragment, found in appdynamics-php-agent/php/conf/appdyanmics_agent.ini. If you configured properties in that file, you need to update them every time you run the installer. It does not overwrite the php.ini file.

If the startup does not succeed, file a support ticket.

Uninstall the PHP Agent using

If you installed the agent using, use to uninstall it.

To uninstall:

1. Shut down the web server.
2. From the PHP agent install directory, run the PHP installer with the -u option: -u

3. Delete the <php_agent_install> directory.

Learn More


  1. Unknown User (

    PHP agent installation has a dependency on php-cli being installed.

    yum install php-cli resolves the issue!

    1. Unknown User (

      That will work.

      Also "apt-get install php5-cli" on Ubuntu.