PHP agent installation: AWS Linux, RedHat, and CentOS

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.

  1. Make sure you have your New Relic license key accessible.
  2. 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
  3. 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.

  4. Run the newrelic-install script and follow the instructions.

    sudo newrelic-install install
  5. Restart your web server (Apache, NGINX, PHP-FPM, etc.).

  6. 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:

Recommendations for learning more: