This page applies to an earlier version of the AppDynamics App IQ Platform.
See the latest version of the documentation.

Skip to end of metadata
Go to start of metadata

On this page:

Your Rating:
1 Star2 Star3 Star4 Star5 Star
49 rates

This topic describes how to install the PHP Agent using the included script. 

Installing the PHP Agent

The following steps describe how to install the PHP Agent with the installation script, 

The installer overwrites any existing settings in the AppDynamics PHP Agent ini fragment, found in appdynamics-php-agent/php/conf/appdynamics_agent.ini. If you have configured properties in that file, you need to update them when you run the installer. The installer does not overwrite the php.ini file.

  1. Verify support and system requirements for your environment as described in Install the PHP Agent

  2. Create the agent installation 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>.

  3. From the command line, change directories to the PHP agent installation directory and untar the agent distribution tarball, as in the following example: 

    cd $<php_agent_install>
    tar -xvjf appdynamics-php-agent-x64-linux.tar.bz2
  4. Set the following permissions on your php_agent_install directory.
    • 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 <full_path_to_php_agent_install_logs>
    • logs – If possible, make the logs subdirectory readable/writable/executable by all.

      chmod 777 <php_agent_install>/logs

      Directory access permissions of 777 may be too permissive for some organizations. In this case, simply make sure that the directory is owned by the apache/php/proxy user.

  5. Run the installation script using the following syntax. 

    $<php_agent_install>/  [-s] -a=<account_name>@<account_access_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>

    The command arguments are described as follows:  

    • -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.
    • -a account_name@account_access_key: The required controller account name and account key. To find your account name and access key, click the settings (gear) icon in the upper right corner of the AppDynamics UI, then click License
    • http-proxy-host and http-proxy-port: 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.
    • http-proxy-userhttp-proxy-password-file: The username and password file if using a proxy and the proxy server requires credentials. 
    • -e option: extensions directory for the file. Needed on Ubuntu as well as when the default PHP CLI binary cannot be determined.
    • -i option: ini directory for the appdynamics_agent.ini file. Needed on Ubuntu as well as 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
    • enable-cli-long-running: Set to true to defend PHP in long-running CLI applications. Defaults to false. See Long-Running CLI Applications with the Suhosin Patch in Configure the Agent for PHP CLI Applications.
    • --log-dir=<dir>: The directory to which the agent and proxy logs should be written. Defaults to the <php_agent_install>/logs directory.
    • --proxy-ctrl-dir=<dir>: The proxy control directory. If not specified, the installer creates a temporary directory.

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

    On Ubuntu the installation needs to be performed as the root user. Also, you need to 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.


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

If there is more than one Apache instance on a 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 PHP Agent Installation Issues.

Installation Command Samples

The following illustrates a sample command to install the agent: controller 8090 -a=PHPCust@XC6v2n8m2$543 myApp myTier myNode

To install the agent using SSL, use the -s switch, as follows: -s -a=PHPCust@XC6v2n8m2$543 8818 myApp myTier myNode

The following sample command illustrates installation with a proxy server present: --http-proxy-host=myproxyhost --http-proxy-port=8099 -a=PHPCust@XC6v2n8m2$543 controller 8090 myApp myTier myNode