PHP agent installation: RedHat and CentOS

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

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

First-time installation

Note: If you have an earlier version of New Relic on your server, see Upgrading your PHP agent to v.3.

For a first time installation:

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

    PlatformCommand
    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 PHP agent or server monitor packages, yum should prompt you to accept the New Relic public key. The key ID should always be 548C16BF, which will result in a prompt similar to this:

    warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key ID 548c16bf: NOKEY
    Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-NewRelic
    Importing GPG key 0x548C16BF:
     Userid : New Relic <support@newrelic.com>
     Package: newrelic-repo-5-3.noarch (installed)
     From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-NewRelic
    Is this ok [y/N]:

    If the key ID is different, please contact New Relic support.

  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 an existing installation

Recommendation: Keep your New Relic agent version up to date, as the agents are updated frequently.

To update 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.

Alternative installation using the tarball

If yum does not work with your server configuration, you can install directly from the binary tarball. The same directions apply for both new installations and updates.

Installing from tar archives does not require any special repository setup.

To install or upgrade the New Relic agent using the tarball:

  1. Download the appropriate tar file from the New Relic download site.

  2. Decompress and extract the archive using the command:

    gzip -dc (filename).tar.gz | tar xf -
  3. Change to the newly created directory. It will have the same name as the tar file

    cd (filename)
  4. Run the newrelic-install script and follow the instructions.

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

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

For more help

Additional documentation resources include:

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