You can use the AppDynamics PHP Agent RPM to install the PHP Agent on RedHat or CentOS Linux systems.

About the RPM Installer

You must use the PHP Agent RPM installer as the root user. 

You pass configuration settings for the agent to the installer using environment variables rather than command-line arguments. Before starting—or as part of your installation script—you need to set the environment variables. You can configure settings such as node name, tier name, business application name, and others for the agent. However, the installer will provide sensible defaults if not provided.  

The RPM installer determines the location of your PHP installation based on the PATH environment variable. It uses the first PHP installation that it encounters in the PATH to configure the installer. If you have installed PHP in a non-standard location, you must provide the directory of your PHP binary in the APPD_PHP_PATH environment variable.

Before starting, get the RPM package from the AppDynamics Download Portal.

Installing the PHP Agent with RPM

To install PHP Agent with RPM:

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

  2. Set environment variables with the configuration settings for the agent if needed. The account key is a required setting. Other settings may be required depending on your environment. See RPM Environment Variables for more information. Alternatively, you can pass environment variables to the installation script directly.
  3. Run the installer. 

    sudo rpm -i <package_name>

    Replace <package_name> with the name of the package you downloaded.

    If you are using sudo to pass the environment variables to the installation script you can use:

    sudo APPD_PHP_PATH=/opt/php rpm -i <package_name>

    or

    APPD_PHP_PATH=/opt/php sudo -E rpm -i <package_name>

    If the install reports errors, check the log file as described in RPM Log File.

  4. Restart Apache. Not required if you are installing an agent to monitor PHP CLI only.

The RPM installs a single agent. If you have more than one PHP installation on the machine, run the RPM once for each PHP installation, each time with the appropriate APPD_PHP_PATH and APPD_CONF_NODE settings.

RPM Environment Variables

Environment Variable

Description

Default

Required?

APPD_PHP_PATH

Directory containing the PHP binary

None

If your PHP binary is not in a standard location. By default, the installer uses the PHP CLI binary to determine where to install the app agent.
APPD_PHP_CONFIGURATION_DIRINI directory in which to install the appdynamics_agent.ini file. Takes precedence over the APPD_PHP_PATH setting.
Directory containing your php.ini file. See information on files added to your installation in Install the PHP Agent.If your PHP binary is not in the standard location or if no PHP CLI binary is available.
APPD_PHP_EXTENSION_DIRExtensions directory in which to install the appdynamics_agent.so file. Takes precedence over the APPD_PHP_PATH setting.
Your PHP extensions directory. See information on files added to your installation in Install the PHP Agent. If your PHP binary is not in the standard location or if no PHP CLI binary is available.
APPD_PHP_VERSIONVersion of PHP that you are instrumenting. Valid formats are version numbers to one or two decimal positions, for example, 5.4 and 5.4.21 are both valid. Takes precedence over the APPD_PHP_PATH setting.Version used by your PHP CLI binaryIf no PHP CLI binary is available, along with the APPD_PHP_CONFIGURATION_DIR and APPD_PHP_EXTENSION_DIR variables.

APPD_CONF_CONTROLLER_HOST

Controller hostname

localhost


APPD_CONF_CONTROLLER_PORT

Controller port

8080


APPD_CONF_APP

Application name

MyApp


APPD_CONF_TIER

Tier name

Hostname of the machine running the script—same as the node name


APPD_CONF_NODE

Node name

Hostname of the machine running the script


APPD_CONF_ACCOUNT_NAME

Account name

Defaults to customer1.

If you have an on-premises AppDynamics Controller running in multi-tenant mode or if you are using the AppDynamics SaaS Controller.

APPD_CONF_ACCESS_KEY

Account key

None

Yes.
To find your access key, click in the upper right corner of the AppDynamics UI, then click License.

APPD_CONF_SSL_ENABLED

True to enable SSL communication with the controller, false otherwise

false


APPD_CONF_HTTP_PROXY_HOST

Hostname or IP address of the http proxy server

None

If you want to route data to the controller through a proxy server.

APPD_CONF_HTTP_PROXY_PORT

HTTP or HTTPS port of the http proxy server; must be set if APPD_CONF_HTTP_PROXY_HOST is set

None

If you want to route data to the controller through a proxy server.
APPD_CONF_HTTP_PROXY_USERUsername on the http proxy serverNoneIf you want to route data to the controller through a proxy server that requires a username.
APPD_CONF_HTTP_PROXY_PASSWORD_FILEPassword on the http proxy serverNoneYou want to route data to the controller through a proxy server that requires a password.
APPD_PROXY_CTRL_DIRInitial control communication directory between the agent and the Java proxyNone


APPD_CONF_LOG_DIRDirectory to which the agent writes the agent and proxy logs<php_agent_install>/logs
APPD_CONF_CLI_LONG_RUNNING_ENABLEDDefends PHP in long-running CLI applications.falseAdvisable if instrumenting long-running CLI applications. See Long-Running CLI Applications with the Suhosin Patch in Configure the Agent for PHP CLI Applications.

Updating the Installation

Any changes that you made to the configuration files are preserved when you re-run the installer. RPM saves your original settings and appdynamics_agent_log4cxx.xml files with the settings from the previous installation.

RPM Installation Log File

If errors occurred during installation, a message displays the location of the log file generated in the /tmp directory. Examine this log file to identify the cause of the problem. A successful installation does not produce a log file. 

Uninstall the PHP Agent using RPM

If you installed the agent using RPM, use RPM to uninstall it, as follows:

sudo rpm -e appdynamics-php-agent-<version>

Notice that you need to identify the version of the package. To find the version of the package that you installed, you can enter:

rpm -qa | grep appdynamics-php-agent

The existing configurations are saved in a tar file in /tmp, as indicated upon completion of the uninstall process.