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.

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.

For a first time installation:

  1. 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
  2. Install the agent and daemon using 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.

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

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

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

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

Upgrading the agent

To upgrade an existing installation:

  1. Replace the agent and daemon:

     sudo yum update newrelic-php5
  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. See PHP Install Script for more information.

  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:
    sudo yum remove newrelic-php5

For more help

Additional documentation resources include:

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