Skip to content

Use New Relic with ServerPilot

To install and configure New Relic’s PHP monitoring, use the instructions in this guide.

For New Relic’s server monitoring, use New Relic’s server monitoring instructions.

Install the New Relic PHP package

SSH into your server as root and run the following commands to install the New Relic PHP package.

Terminal window
wget -O - https://download.newrelic.com/548C16BF.gpg | sudo apt-key add -
sudo bash -c "echo deb http://apt.newrelic.com/debian/ newrelic non-free > /etc/apt/sources.list.d/newrelic.list"
sudo apt-get update
sudo apt-get install newrelic-php5

Add New Relic monitoring to a PHP version

Repeat the following instructions for each PHP version you will monitor using New Relic.

Install the New Relic extension.

Terminal window
sudo NR_INSTALL_PATH=/opt/sp/php8.4/bin newrelic-install

When prompted, choose option #1 (“Install the New Relic Agent and Daemon”).

Enter your New Relic license key when prompted.

The New Relic installer will create the file /etc/phpX.Y-sp/conf.d/newrelic.ini where “X.Y” is the PHP version. This is where you can edit your New Relic license key.

Finally, restart PHP.

Terminal window
sudo service php8.4-fpm-sp restart

You can confirm that New Relic installed by looking for it in the output of phpinfo() or with phpX.Y-sp -i at the command line. For example:

$ php7.2-sp -i | grep newrelic
newrelic
newrelic.daemon.logfile => /var/log/newrelic/newrelic-daemon.log
newrelic.daemon.ssl => enabled
newrelic.logfile => /var/log/newrelic/php_agent.log
newrelic.loglevel => no value
...

Set the New Relic app name

You can identify individual apps to New Relic by creating a .user.ini file in an app’s web root directory with the contents:

newrelic.appname = "APPNAME"

This sets the name of the New Relic application name you see when logged into New Relic.