Where to Configure Settings
There are three files from which the PHP Agent configuration settings are read:
- appdynamics_agent.ini
- 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 appdynamics_agent.ini
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 api App
<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 frontend App
<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 frontend App
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