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

PHP agent installation: Non-standard PHP (advanced)

If you are using a non-standard PHP installation, follow this procedure to properly install New Relic. This is common in instances where the default installer does not find your PHP installation (for example, if you have self-compiled PHP or a self-contained PHP stack).

重要

As part of the installation process, change the default application name to a meaningful name.

Requirements

Use the command line version of PHP (php -i) or look at the output of phpinfo() to determine:

  • The PHP extension version (20090626, 20100525, 20121212, 20131226, 20151012, or 20160303)
  • The extension or module installation directory
  • Whether or not your version of PHP has been compiled with ZTS (Zend Thread Safety) support

Using the command line newrelic-install script (recommended)

  1. Point New Relic at the right directory by using any of these options:

  2. Invoke the newrelic-install script from its directory. Depending on your server and your paths, the install script may find other versions of PHP on your system. Select your specific version from the list.

For more information, see PHP install script. Or, to resume your installation instructions, see New Relic for PHP.

Installing New Relic manually

If you do not want to use the install script, you can perform a fully manual installation. You will need to gather information about your PHP installation, as described above, and create and link or copy the files into place manually.

You can review and obtain the appropriate values from your phpinfo() yourself.

Obtaining installation parameters from phpinfo()

If this process doesn't work for you, you can obtain the correct information from your phpinfo() and pass the appropriate settings to your system as environment variables.

phpinfo()

Notes

PHPAPI

This is labeled PHP Extension in the phpinfo() header.

ARCH

This can be determined by executing file /path/to/php.

  • If you see a reference to ELF-32, then the ARCH is x86.
  • If you see a reference to ELF-64, then the ARCH is x64.

MODULEDIR

This is labeled extension_dir in the PHP Core section.

PHPZTS

To determine whether ZTS is compiled in, look for the Thread Safety setting at the top of the phpinfo() output.

  • If this is disabled, then PHPZTS is empty.
  • If this is enabled, then PHPZTS is the string -zts, which includes a leading hyphen as noted.

NRBASEDIR

This is the base directory of the New Relic agent installation directory (/usr/lib/newrelic-php5 or the directory in which you extracted the tar file for tarball installations).

Use this information to execute the following commands to install the PHP module. Be sure to adjust the example's values to your actual settings.

NRBASEDIR=/usr/lib/newrelic-php5; export NRBASEDIR
    MODULEDIR=/usr/lib/php/modules; export MODULEDIR
    ARCH=x64; export ARCH
    PHPAPI=20090626; export PHPAPI
    PHPZTS="-zts"; export PHPZTS
    rm -f $MODULEDIR/newrelic.so
    ln -s $NRBASEDIR/agent/$ARCH/newrelic-${PHPAPI}${PHPZTS}.so \
      $MODULEDIR/newrelic.so

The next step is configuration.

  1. Copy the $NRBASEDIR/scripts/newrelic.ini.template to the directory from where your PHP installation reads additional config files and rename it newrelic.ini.

    To determine the destination, look at your phpinfo() output for the item, called Scan this dir for additional .ini files. If the directory listed is (none), add settings from this file to your listed php config files (usually php.ini).

  2. Replace the license key setting in your newrelic.ini file with your license key. Also change any other sessions as needed (for example, newrelic.appname).

  3. Copy $NRBASEDIR/daemon/newrelic-daemon.$architecture to /usr/bin/newrelic-daemon.

    Depending on your system, $architecture will be either x86 or x64.

  4. Restart your dispatcher/webs erver.

  5. Verify that your site is functioning properly. If it is not, remove newrelic.ini or the newrelic.so you created, and restart your dispatcher/web server again to restore old operation.

  6. Examine your web server/dispatcher (not newrelic) logfiles to help determine the issue. If you still need assistance, get support at support.newrelic.com.

    Check that the agent is installed after the restart, by investigating the phpinfo() page for a newrelic section. If it appears the agent was successfully installed, check your system to verify that two newrelic-daemon processes are running:

  • For RedHat based systems:

    ps -aef | grep newrelic-daemon
  • For Debian based systems:

    ps aux | grep newrelic-daemon

Wait for 3 to 5 minutes for results to arrive in your APM Summary page.

For more help

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

その他のヘルプ

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

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