Follow this procedure to install New Relic APM's PHP agent using AWS Linux 2, RedHat, or CentOS. This is not the same as the CentOS procedures for New Relic Infrastructure.
If you have an earlier version of New Relic installed, upgrade the agent instead of following the instructions on this page.
Install the agent
Even though the package name for the PHP agent refers to PHP 5, the package works for all supported PHP versions, including PHP 7 versions.
- Make sure you have your New Relic license key accessible.
-
Use either of the following ways to obtain the installation package:
- Tell the package manager (rpm) about the New Relic repository
-
For 32-bit systems, run:
sudo rpm -Uvh http://yum.newrelic.com/pub/newrelic/el5/i386/newrelic-repo-5-3.noarch.rpm
For 64-bit systems, run:
sudo rpm -Uvh http://yum.newrelic.com/pub/newrelic/el5/x86_64/newrelic-repo-5-3.noarch.rpm
- Download the rpm file from the New Relic website
-
For 32-bit systems, download these three files from the 32-bit packages (replacing
X.X.X.X
with the most recent PHP agent version number):newrelic-php5-common-X.X.X.X-1.noarch.rpm
newrelic-daemon-X.X.X.X-1.i386.rpm
newrelic-php5-X.X.X.X-1.i386.rpm
For 64-bit systems, download these three files from the 64-bit packages (replacing
X.X.X.X
with the most recent PHP agent version number):-
newrelic-php5-common-X.X.X.X-1.noarch.rpm
newrelic-daemon-X.X.X.X-1.x86_64.rpm
newrelic-php5-X.X.X.X-1.x86_64.rpm
-
Install the agent and daemon using your preferred package manager:
- yum
-
sudo yum install newrelic-php5
The first time you install New Relic for PHP, yum prompts you to accept the New Relic public key. New Relic's key ID is
548C16BF
. - 32-bit rpm
-
Replace
X.X.X.X
with the most recent PHP agent version number when you run this command:rpm -i newrelic-php5-common-X.X.X.X-1.noarch.rpm newrelic-daemon-X.X.X.X-1.i386.rpm newrelic-php5-X.X.X.X-1.i386.rpm
- 64-bit rpm
-
Replace
X.X.X.X
with the most recent PHP agent version number when you run this command:rpm -i newrelic-php5-common-X.X.X.X-1.noarch.rpm newrelic-daemon-X.X.X.X-1.x86_64.rpm newrelic-php5-X.X.X.X-1.x86_64.rpm
- tarball
-
If yum and rpm do not work with your host config, install from the binary tarball.
-
Run the
newrelic-install
script and follow the instructions.sudo newrelic-install install
-
Restart your web server (Apache, NGINX, PHP-FPM, etc.).
- Generate traffic to your application, and wait a few minutes for it to send data to New Relic. Then, check your app's performance in the New Relic UI.
For more help
Additional documentation resources include:
- No data appears (troubleshooting instructions for the PHP agent)
- PHP install script (more information about installing the agent)
- New Relic for PHP configuration (information on configuring your agent)
- PHP agent installation: non-standard PHP (install on a non-standard PHP configuration)
- Uninstall (uninstall the PHP agent)