Skip to content

Duplicate newrelic.ini files created when installing PHP APM agent with install script on Ubuntu and Debian servers #852

Open
@tbrack

Description

@tbrack

Description

My team has been implementing New Relic monitoring on several PHP applications we support, and every time we install the agent it creates a second 20-newrelic.ini file. This causes a second APM app named "PHP Application" to begin reporting to New Relic which increases our ingest costs.

This occurs when using the guided install script as well as using the Ansible newrelic-install role. I believe the ansible role extends the guided install script so I suspect its the same issue.

Steps to Reproduce

  1. Install PHP on an Ubuntu server
  2. Run the New Relic guided install script
curl -Ls https://download.newrelic.com/install/newrelic-cli/scripts/install.sh | bash && sudo NEW_RELIC_API_KEY=xxxxx NEW_RELIC_ACCOUNT_ID=xxxxxx /usr/local/bin/newrelic install
  1. When prompted to install PHP agent select yes
  2. Enter a unique application name
  3. Complete the install
  4. Run php -i | grep newrelic

Expected Behavior

There should be one newrelic.ini file. There shouldn't be an additional 20-newrelic.ini file.
The ini file should have the newrelic.appname specified during the install process.
Only the new app should show up in the New Relic APM Services console.

Relevant Logs / Console output

php -i | grep newrelic
PHP Warning:  Module "newrelic" is already loaded in Unknown on line 0
/etc/php/8.1/cli/conf.d/20-newrelic.ini,
/etc/php/8.1/cli/conf.d/newrelic.ini


ls -l /etc/php/8.1/cli/conf.d/20-newrelic.ini
lrwxrwxrwx 1 root root 40 Mar 14 00:00 /etc/php/8.1/cli/conf.d/20-newrelic.ini -> /etc/php/8.1/mods-available/newrelic.ini


cat /etc/php/8.1/cli/conf.d/20-newrelic.ini | grep newrelic.appname
; Setting: newrelic.appname
newrelic.appname = "Test App"

cat /etc/php/8.1/cli/conf.d/newrelic.ini | grep newrelic.appname
; Setting: newrelic.appname
newrelic.appname = "PHP Application"

Your Environment

I've observed this on Ubuntu 22.04.3 LTS and Debian GNU/Linux 11 (bullseye)

Seen with both php 8.1 and php8.2, as well as both nginx and apache webservers.

Additional context

These servers run on AWS EC2 and were built using the AWS quickstart templates for Ubuntu and Debian.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions