---
title: Multiple accounts
source: https://docs.newrelic.com/docs/apm/agents/php-agent/features/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 [#vhost]

Set a New Relic license key for each virtual host using `newrelic.license`.

For example, with Apache:

```apacheconf
<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 [#withapi]

Use `newrelic_set_appname()` to change the account during the current transaction.

For example:

```php
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.
