• /
  • ログイン
  • 無料アカウント

PHP per-directory INI settings

Most PHP agent configuration variables can be set on a per-directory basis. This option is often used when there is a single web server serving multiple applications, and you want to adjust settings (for example, the app name) on an application-by-application basis.

The process for setting per-directory values depends on the environment. This document describes the three most common environments:

For other app naming options, see Name your PHP application.

Another option: API calls

If you are trying to change the name the application reports as, you can use the newrelic_set_appname() API call instead of per-directory settings. For other settings that you can modify with the API, see PHP agent API.

If you do not have access to the code for your application, or if you need to isolate your applications to their own virtual hosts for other reasons, then use the following per-directory settings to override any configuration file settings.

Apache per-directory settings for PHP

When using the PHP module, Apache provides two mechanisms for setting PHP variables outside the INI file:

PHP-FPM per-directory settings

The FastCGI Process Manager (PHP-FPM) is dedicated to PHP. It spawns a number of worker processes that wait for requests. It increases performance by not re-initializing the PHP engine on each invocation, allowing each process to deal with a number of requests before it recycles.

For more information on PHP-FPM, see PHP-FPM's about page and FastCGI Process Manager on php.net.

When using PHP-FPM, there are two mechanisms for setting PHP variables outside the INI file and one special technique for NGINX:

Roll-up application names

If you want to have an overall view of how the server is performing across all virtual hosts or all applications, it is convenient to be able to report to more than one application at a time. For example, report to a virtual host specific application as well as a roll-up application.

To do this, set more than one application name for the newrelic.appname parameter by separating each application name with a semicolon. The primary application name is first, and the secondary application names next. You can define up to two extra application names.

For example:

newrelic.appname="Virtual Host 1;All Virtual Hosts"

This will report to two New Relic applications: "Virtual Host 1" and "All Virtual Hosts".

重要

This feature is only available in versions 2.4 or higher of the PHP agent.

For more help

If you need more help, check out these support and learning resources:

その他のヘルプ

さらに支援が必要な場合は、これらのサポートと学習リソースを確認してください:

問題を作成するこのページを編集する
Copyright © 2020 New Relic Inc.