You can configure New Relic to support multiple accounts per host. For example, you may be a service provider supporting multiple customers in a shared hosting environment.
Contents
Set per virtual host
Set a New Relic license key for each virtual host using newrelic.license
.
For example, with Apache:
<VirtualHost 192.168.42.43>
ServerName www.myvhost1.com
DocumentRoot "/path/to/vhost1/"
...
<IfModule php5_module>
php_value newrelic.license "NEW RELIC LICENSE KEY 1"
</IfModule>
</VirtualHost>
<VirtualHost 192.168.123.45>
ServerName www.myvhost2.com
DocumentRoot "/path/to/vhost2/"
...
<IfModule php5_module>
php_value newrelic.license "NEW RELIC LICENSE KEY 2"
</IfModule>
</VirtualHost>
Set with the API
Use newrelic_set_appname()
to change the account during the current transaction.
For example:
newrelic_set_appname("APP NAME", "NEW RELIC LICENSE KEY");
Set this as early in the transaction process as possible; otherwise the transaction may already be locked into a prior configuration.
Note: newrelic_start_transaction()
can also be used. This is not typical usage.
For more help
Additional documentation resources include:
- The PHP API (the PHP API reference)
- PHP agent (newrelic.ini) settings (The PHP .ini file reference)
- PHP per-directory INI settings (configuring New Relic on a per directory basis)
- Creating multiple accounts (setting up multiple New Relic accounts on the same email)