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).
Importante
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
, or20160303
) - The extension or module installation directory
- Whether or not your version of PHP has been compiled with ZTS (Zend Thread Safety) support
ZTS options apply only to PHP agent versions 9.17 and earlier. ZTS is not available for PHP versions 9.18 or higher.
Use the command line newrelic-install script (recommended)
Point New Relic at the right directory by using any of these options:
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.
Install New Relic manually
If you do not want to use the install script, you can perform a fully manual installation. Be sure to gather information about your PHP installation. You can review and obtain the appropriate values from your phpinfo()
. Then create and link or copy the files into place manually.
Get installation parameters from phpinfo()
If this process doesn't work for you, you can get the correct information from your phpinfo()
and pass the appropriate settings to your system as environment variables.
phpinfo() | Notes |
---|---|
| This is labeled |
| This can be determined by executing
|
| This is labeled |
| ZTS options apply only to PHP agent versions 9.19.0.309 and earlier. ZTS is not available for PHP agent versions 9.20.0.310 or higher. To determine whether ZTS is compiled in, look for the
|
| This is the base directory of the New Relic agent installation directory; for example, |
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
Manual configuration
The next step is configuration.
Copy the
$NRBASEDIR/scripts/newrelic.ini.template
to the directory from where your PHP installation reads additional config files and rename itnewrelic.ini
.To determine the destination, look at your
phpinfo()
output for the item, calledScan this dir for additional .ini files
. If the directory listed is(none)
, add settings from this file to your listed PHP config files (usuallyphp.ini
).Replace the license key setting in your
newrelic.ini
file with your . Also change any other sessions as needed (for example,newrelic.appname
).Copy
$NRBASEDIR/daemon/newrelic-daemon.$architecture
to/usr/bin/newrelic-daemon
.Depending on your system, $architecture will be either x86 or x64.
Restart your dispatcher/web server.
Verify that your site is functioning properly. If it isn't, remove
newrelic.ini
or thenewrelic.so
you created, and restart your dispatcher/web server again to restore the old operation.Examine your web server/dispatcher logfiles (not
newrelic
) to help determine the issue. If you still need assistance, get support at support.newrelic.com.
Verify installation
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:
bash$ps -aef | grep newrelic-daemonFor Debian based systems:
bash$ps aux | grep newrelic-daemon
Generate some traffic on your app, then wait for three to five minutes for results to arrive in your APM Summary page.