PHP agent installation: RedHat and CentOS

This procedure is for installing New Relic's PHP agent using RedHat or CentOS. For procedures to install the monitoring agent for New Relic Servers, see Server monitor installation: RedHat and CentOS.

Note: As part of the installation process, change the default application name to a meaningful name.

Obtaining the installation package

There are two ways to obtain the installation package:

Tell the package manager (rpm) about the New Relic repository

Tell the package manager (rpm) about the New Relic repository:

Platform Command
For 32-bit systems use
sudo rpm -Uvh http://yum.newrelic.com/pub/newrelic/el5/i386/newrelic-repo-5-3.noarch.rpm
For 64-bit systems use
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

Download the rpm file from the New Relic website:

  • Download the following three files from the 32-bit packages:
    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
  • Download the following three files from the 64-bit packages:
    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

Installing the agent

Note: These commands apply only to first-time installations. If you have an earlier version of New Relic installed, see Upgrading the agent.

  1. Install the agent and daemon using your preferred package manager:

    Manager Directions
    yum
    sudo yum install newrelic-php5

    Note: 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
    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
    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 server configuration, install from the binary tarball.
  2. Run the newrelic-install script and follow the instructions.

    sudo newrelic-install install
  3. Restart your web servers (httpd, nginx, php-fpm, etc.).

  4. Wait a few minutes for your application to send data to New Relic, or refer to the troubleshooting instructions.

For more information about installing the PHP agent, see PHP install script, or see the configuration section in New Relic for PHP to configure your agent.

Upgrading the agent

  1. To upgrade an existing installation, replace the agent and daemon using your preferred package manager:

    Manager Directions
    yum If you are using the New Relic repositories directly, upgrade to the latest agent using the following command:

    sudo yum update newrelic-php5
    32-bit rpm Download the newest version of the .rpm files from the New Relic website, and run the following command. Make sure to replace X.X.X.X with the latest New Relic for PHP version number.

    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 Download the newest version of the .rpm files from the New Relic website, and run the following command. Make sure to replace X.X.X.X with the latest New Relic for PHP version number.

    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
  2. If you have added any new PHP installations or versions since your last New Relic installation, re-run the newrelic-install script and follow the instructions.

    sudo newrelic-install install

    The script will ask for confirmation before overwriting an old install. For more information, see PHP install script.

  3. Restart your web servers (httpd, nginx, php-fpm, etc.).

  4. Wait a few minutes for your application to send data to New Relic.

Uninstalling the agent

To uninstall the agent:

  1. Run newrelic-install with no options and select the uninstall option from the main menu when invoking the script.
  2. Remove remaining New Relic configuration files. The uninstall script does not remove vital configuration files such as your daemon configuration file, nor does it remove any newrelic.ini files which you have modified. These files are preserved in case the reason for the uninstall is to upgrade.
  3. Remove files specific to the package manager:

    Using yum:

    sudo yum purge newrelic-php5

    Using rpm (32-bit). Be sure to replace X.X.X.X with the installed New Relic for PHP version number:

    rpm -e 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

    Using rpm (64-bit). Be sure to replace X.X.X.X with the installed New Relic for PHP version number:

    rpm -e 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

For more help

Additional documentation resources include:

If you need additional help, get support at support.newrelic.com.