New Relic for PHP gives you several ways to change the application name that is reported to, and displayed in, New Relic. This document gives you an overview of those naming options.
For a general overview of APM app naming (not PHP-specific), see Name your application.
Set or change app name
New Relic differentiates applications by their name. When you change the name an application reports as, New Relic creates a new application entity and breaks data continuity between the new and old entity. To change an application's name without breaking data continuity, use the UI alias-change option.
Here are the ways to change your PHP application's name in New Relic:
newrelic.appname: The recommended and most commonly used option.
- Set per-directory INI settings: Useful for when you have one web server serving multiple applications and want to have different settings or names for them. (Procedures for Apache, PHP-FPM, and NGINX in PHP-FPM are documented.)
- Change alias via UI: This changes only the alias in the UI, not the underlying app name being reported. (This option does not break data continuity in APM.)
- Change via API: An option if you have access to modify your application code, are okay with instrumenting it directly, and find the trace continuity implications of this call acceptable.
Use multiple app names
The ability to set multiple app names is only available in PHP agent versions 2.4 or higher.
You can use multiple app names to aggregate data from several applications under the same name in APM (sometimes referred to as "rolling up" your data). For more about how multiple app names work, see Use multiple app names.
For PHP, you can set up to three application names. The primary application name is first, and the second and third names are used for the more general data aggregation categories.
- PHP config file example
Here is an example of setting multiple names in the
newrelic.appname="Virtual Host 1;Virtual Hosts in Some Region;All Virtual Hosts"