Our PHP agent auto-instruments your code so you can start monitoring applications. These are the standard procedures to install our PHP agent on Ubuntu or Debian. (This is not the same as the Ubuntu and Debian procedures for the infrastructure monitoring agent.) For other situations, see the PHP agent procedures for non-standard PHP installations.
PHP versions
The package name for New Relic's PHP agent is newrelic-php5
. Although the package name references PHP 5, this package works for all supported PHP versions.
Recommended: Use apt
This is the recommended method for New Relic installation and maintenance.
Important
Run the commands in this procedure as root.
Step | Notes |
---|---|
1. | Configure the New Relic apt repository.
This command adds This step is only required once per system. |
2. | Trust the New Relic GPG key. This step is required to register New Relic as an authenticated source where apt-get will look for new packages. To get the New Relic public apt-key from global key servers, run the following command as root:
If you do not run this command as root, you may see an error message about the public key. |
3. | Update the local package list. Execute the following command as root:
|
4. | Install the PHP agent. Execute the following command to install directly from the New Relic repositories:
|
5. | Non-standard installations: Complete installation manually. If you are not using the default Ubuntu or Debian PHP packages, the
If so, run the following command:
|
6. | Configure your application name and New Relic license key. The installation process prompts for your application name and license key. Your appears in the account information section of Account settings. For headless installations, you can also preseed your license key and application name by using |
7. | Restart your web server or FastCGI Process Manager (FPM). Generate traffic for your app, and wait a few minutes for your application to send data to New Relic. Then, check your app's performance in the New Relic UI. |
Optional: Unattended installation
To run an unattended installation, you can use non-interactive mode. Include the -y
flag to automatically respond yes
to any prompt during package installation. For example:
DEBIAN_FRONTEND=noninteractive apt-get -y install newrelic-php5
Manual: Use dpkg
Important
If you use dpkg
, you must manually install updates. This is why New Relic recommends the apt
method for installation and maintenance. Run the commands in this procedure as root.
To install the PHP agent manually using dpkg
:
Step | Notes |
---|---|
1. | Copy the URL for the package download. Navigate to the appropriate URL for your architecture, and copy the full URL for the latest |
2. | Download the package. Run the following
|
3. | Install the PHP agent. Run the appropriate command as root, replacing 32-bit:
64-bit:
|
4. | Configure your application name and New Relic license key. The installation process prompts for your application name and license key. Your appears in the account information section of Account settings. For headless installations, you can also preseed your license key and application name by using |
5. | Restart your web server or FastCGI Process Manager (FPM). Generate traffic for your app, and wait a few minutes for your application to send data to New Relic. Then, check your app's performance in the New Relic UI. |
Did this doc help with your installation?
Headless: Preseed license key and app name
For headless installations, you can preseed your and application name. You must use the default php5 packages provided by your distribution. To preseed, set values in your debconf
database by using debconf-set-selections
.
Important
These settings will be ignored if you are not using a packaged PHP. You will be prompted to run newrelic-install
.
These keys are located in the newrelic-php5
package:
Name | Type |
---|---|
The name of your app. This string sets | string |
Your . This string sets | string |
For example, you can run these commands to preseed your app name and license key:
echo newrelic-php5 newrelic-php5/application-name string "My App Name" | debconf-set-selectionsecho newrelic-php5 newrelic-php5/license-key string "YOUR_LICENSE_KEY" | debconf-set-selections