On this page:
- Install the PHP Agent using a Shell Script
- Install the PHP Agent using RPM
- Special Procedures for PHP CLI
- Special Considerations for PHP on Mac OSX
- Special Considerations for PHP with SELinux
- Special Procedures For Multi-App/Single-Server (MASS) Environments
- Upgrade the PHP Agent
- Resolve Installation Issues for PHP
You can install the PHP Agent using either a shell script (install.sh) or the RPM Package Manager (RPM).
These instructions assume that you are installing the AppDynamics PHP Agent in a standard PHP environment, specifically:
- a single PHP installation running on the Linux or OSX 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 one or more of these assumptions is violated.
This basic installation results in an AppDynamics model of your application consisting of one application, one tier, and one node.
If you have multiple PHP applications running on the same host and you want to monitor them as separate entities, see also the special instructions in Special Procedures For Multi-App/Single-Server (MASS) Environments.
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 PHP Agent 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:
- PHP Agent - 32 bit RPM
- PHP Agent - 64 bit RPM
On all other Linux:
- PHP Agent - 32 bit Linux
- PHP Agent - 64 bit Linux
On Mac OSX:
- PHP Agent - 64 bit OSX
If you use an on-premise Controller, download the latest version of the AppDynamics Controller. The download site is https://appdynamics.com/download.
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.
- AppDynamics account name
- AppDynamics 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.
6. Stop the Apache server.
Installing the PHP Agent
To use install.sh, see Install the PHP Agent using a Shell Script. Use install.sh to install on OSX as well as LInux.
To use RPM, see Install the PHP Agent using RPM.
To instrument PHP CLI, see also Special Procedures for PHP CLI.
To instrument an application on OSX, see Special Considerations for PHP on Mac OSX.
To instrument an application running in SELinux, see Special Considerations for PHP with SELinux.
To instrument multiple PHP applications running on the same server, see Special Procedures For Multi-App/Single-Server (MASS) Environments.
Files Added to Your 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:
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.
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 ther 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 using RPM.
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 PHP Agent will fail to register.
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 machine agent's controller-info.xml file. If you do, the PHP Agent may fail to register.