Download page Multiple PHP Apps on a Single Server.
Multiple PHP Apps on a Single Server
If you follow only the default installation instructions, the PHP Agent treats your entire PHP deployment as a business application with a single tier with a single node. It models your AppDynamics environment this way even if in reality you have multiple PHP applications running in the same Apache or PHP-FPM pool.
You may have configured your PHP applications as different virtual hosts or FPM pools. With multi-application/single-server (MASS) support, you can monitor several PHP applications running on the same server as separate AppDynamics entities, represented as different business applications, different tiers or different nodes. Multiple applications running in the same PHP server can have separate metrics, dashboards, health rules, events, and so on. You can monitor them on different controllers, even from different AppDynamics accounts. You can mix and match the settings to configure the AppDynamics model that works best for monitoring your entire PHP application environment.
AppDynamics recommends that you not instrument more than ten applications on a single server.
Download and Install
To set up your PHP installation for multiple nodes, download a single agent from AppDynamics.
Then follow the instructions in Install the PHP Agent by RPM—RedHat and CentOSX—and Install the PHP Agent by Shell Script—all other Linux and Mac OS—for instrumenting the agent. Configure the required settings using an app/tier/node configuration that fits one of the applications you are instrumenting. Make sure you configure the required settings listed below.
Then, for each additional application that you want the agent to monitor, add an AppDynamics configuration with different settings that reflect how you want the performance metrics to be reported in your AppDynamics model.
Required Configuration Settings for Multi-Node Support
The required settings for multi-node support for each monitored app are:
It may be necessary to configure additional settings depending on your environment, for example, if you need to route data to the AppDynamics controller through a proxy server.
Where to Configure Settings
There are three files from which the PHP Agent configuration settings are read:
- Apache (vhost) or FMP (fpm-pool) configuration (overrides 1)
- .htaccess for Apache or .user.ini for FPM (overrides 1 and 2)
When you instrument your first application, passing the required settings on the command-line—shell script install—or through environment variables (RPM install), those settings are written to
To apply different sets of settings for the different applications, as best practice specify the settings in each vhost or FPM pool config block.
Sample Apache Configuration
Here are sample virtual host configurations for two applications running on the same server.
Virtual Host Configuration for the
<VirtualHost *:80> ServerName api.myhost.com DocumentRoot "/var/www/api" ErrorLog "/private/var/log/apache2/api_error.log" CustomLog "/private/var/log/apache2/api_access.log" common php_value agent.applicationName API php_value agent.tierName api-tier1 php_value agent.nodeName api-node1 php_value agent.controller.hostName appd1.saas.appdynamics.com php_value agent.controller.port 8080 php_value agent.accountName customer1 php_value agent.accountAccessKey 123456789 </VirtualHost>
Virtual Host Configuration for the
<VirtualHost *:80> ServerName www.myhost.com DocumentRoot "/var/www/frontend" ErrorLog "/private/var/log/apache2/www_error.log" CustomLog "/private/var/log/apache2/www_access.log" common php_value agent.applicationName FrontEnd php_value agent.tierName frontend-tier1 php_value agent.nodeName frontend-node1 php_value agent.controller.hostName appd1.saas.appdynamics.com php_value agent.controller.port 8080 php_value agent.accountName customer1 php_value agent.accountAccessKey 123456789 </VirtualHost>
Sample FPM Configuration
Here are sample FPM configurations for two applications running on the same server.
.conf Configuration for the "api" App
api.conf: php_value[agent.applicationName] = API php_value[agent.tierName] = api-tier1 php_value[agent.nodeName] = api-node1 php_value[agent.controller.hostName] = appd1.saas.appdynamics.com php_value[agent.controller.port] = 8080 php_value[agent.accountName] = customer1 php_value[agent.accountAccessKey] = 123456789
.conf Configuration for the
www.conf: php_value[agent.applicationName] = FrontEnd php_value[agent.tierName] = frontend-tier1 php_value[agent.nodeName] = frontend-node1 php_value[agent.controller.hostName] = appd1.saas.appdynamics.com php_value[agent.controller.port] = 8080 php_value[agent.accountName] = customer1 php_value[agent.accountAccessKey] = 123456789