• /
  • Log in
  • Free account

Multiple accounts

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.

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

  • Suggest a change and learn how to contribute to our PHP agent open source repository.

Additional documentation resources include:

Create issueEdit page
Copyright © 2021 New Relic Inc.