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.
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.
sudo NR_INSTALL_PATH=/opt/sp/php8.4/bin newrelic-install
sudo NR_INSTALL_PATH=/opt/sp/php8.3/bin newrelic-install
sudo NR_INSTALL_PATH=/opt/sp/php8.2/bin newrelic-install
sudo NR_INSTALL_PATH=/opt/sp/php8.1/bin newrelic-install
sudo NR_INSTALL_PATH=/opt/sp/php8.0/bin newrelic-install
sudo NR_INSTALL_PATH=/opt/sp/php7.4/bin newrelic-install
sudo NR_INSTALL_PATH=/opt/sp/php7.3/bin newrelic-install
sudo NR_INSTALL_PATH=/opt/sp/php7.2/bin newrelic-install
sudo NR_INSTALL_PATH=/opt/sp/php7.1/bin newrelic-install
sudo NR_INSTALL_PATH=/opt/sp/php7.0/bin newrelic-install
sudo NR_INSTALL_PATH=/opt/sp/php5.6/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.
sudo service php8.4-fpm-sp restart
sudo service php8.3-fpm-sp restart
sudo service php8.2-fpm-sp restart
sudo service php8.1-fpm-sp restart
sudo service php8.0-fpm-sp restart
sudo service php7.4-fpm-sp restart
sudo service php7.3-fpm-sp restart
sudo service php7.2-fpm-sp restart
sudo service php7.1-fpm-sp restart
sudo service php7.0-fpm-sp restart
sudo service php5.6-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 newrelicnewrelicnewrelic.daemon.logfile => /var/log/newrelic/newrelic-daemon.lognewrelic.daemon.ssl => enablednewrelic.logfile => /var/log/newrelic/php_agent.lognewrelic.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.