You can install the app agent for PHP using either a Linux shell script (install.sh) or the RPM Package Manager (RPM).
These instructions assume that you are installing the AppDynamics App Agent for PHP in a standard PHP environment, specifically:
- a single PHP installation running on the LInux machine
- PHP 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 your PHP configuration
It is possible that the installer will work if if one or more of these assumptions is violated.
This installation results in an AppDynamics model of your application consisting of one application, one tier, and one node.
Prerequisites for Agent Installation
1. Confirm that you have a supported environment installed on the server and that the server is configured correctly to run PHP scripts.
How you do this depends on your PHP environment. For example, in our Ubuntu 12+ web server running Apache we use:
In our CentOS 5+ web server running Apache mod_ssl we use:
2. Confirm that your PHP was not built with the enable-debug configure option.
The App Agent for PHP is incompatible with PHP builds that were compiled with debugging symbols.
To determine whether your PHP was built with debugging symbols you can use the following command:
The response should be:
3. Install the PHP application that you want to monitor, if it is not already installed.
4. Download the the appropriate PHP agent installer for your platform.
On RedHat and CentOS:
- To use the RPM installer for the 32-bit agent, download appdynamics-php-agent-agent-version-number-i686.rpm.
- To use the RPM installer for the 64-bit agent, download appdynamics-php-agent-agent-version-number-x86_64.rpm.
On all other platforms:
- To use install.sh for the 32-bit agent, download appdynamics-php-agent-x86-linux.tar.bz2.
- To use install.sh for the 64-bit agent, download appdynamics-php-agent-x64-linux.tar.bz2.
If you use an on-premise Controller, download the latest version of the AppDynamics Controller. The download site is http://download.appdynamics.com.
5. Be prepared to provide the following information to the installation script:
- controller host and controller port: These are the host name or IP address and the port number of the AppDynamics controller that the agent connects to. SaaS customers receive this information from AppDynamics. On-premise customers establish these settings when they install the controller.
- AppDynamics application name: This is the name that you assign to the business application you will monitor with AppDynamics.
- AppDynamics tier name: This is the name that you assign to the tier you will monitor with AppDynamics.
- AppDynamics node name: This is the name of the basic unit of processing that the agent monitors.
If you have an on-premise AppDynamics controller running in multi-tenant mode or if you are using the AppDynamics SaaS Controller, you will also need to provide the following, which were included in your Welcome email from AppDynamics:
- AppDynamics account name
- AppDynamics account key
6. Stop the Apache server.
Install the Agent for PHP
To use install.sh, see Install the App Agent for PHP using a Shell Script.
To use RPM, see Install the App Agent for PHP using RPM.
Files Added to Your Installation
.ini and .so files
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:
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.
The installer also installs the appdynamics_agent.so file in your PHP extensions directory. You can find this directory using the following command:
There is an agent log and a proxy log for each application.
The agent log is located at $<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
The proxy log is located $<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.
Special Procedures for PHP CLI
By default, the proxy component of the App Agent for PHP is configured to launch automatically when the agent starts up.
However, if you plan to instrument a PHP CLI entry point, you must arrange to run the proxy daemon manually.
If you have PHPs running CLI and apache on the same machine, your AppDynamics setup depends on whether you want all the traffic reported against a single AppDynamics node or separate nodes. A separate proxy is required for each AppDynamics node that you want to monitor in the controller.
If you want all the CLI traffic to be reported against one node and all the web traffic to be reported against a different node, configure apache to auto-launch the proxy (the default) and configure CLI to use a manually-launched proxy. This requires separate php.ini files - one for the web PHP with agent.auto_launch_proxy set to 1 and another for PHP CLI with agent.auto_launch_proxy set to 0.
If you want the web traffic and the CLI traffic to be reported against the same node, configure both apache and CLI to use the same manually launched proxy.
See Running the PHP Proxy Daemon Manually for details.
Installing the Machine Agent on a PHP Node
If you install the machine agent on the machine hosting the instrumented PHP node and you specify the tier and node name in the machine agent's controller-info.xml file, the app agent for PHP will fail to register.
To avoid this problem:
- Install the app agent for PHP before you install the machine agent
- Do not specify the tier and node in the machine agent controller-info.xml, where it is optional. The machine agent will pick up the tier and node from the app agent configuration.
Post Installation Tasks
Set any PHP proxy configuration properties that you have not already set in the install command.
- Install the App Agent for PHP using a Shell Script
- Install the App Agent for PHP using RPM
- Upgrade the App Agent for PHP
- Running the PHP Proxy Daemon Manually
- Resolve Installation Issues for PHP
- App Agent for PHP Proxy Configuration Properties
- Machine Agent Configuration Properties
- Install the Standalone Machine Agent
- AppDynamics for PHP Architecture
- Install the Controller