login and create new rellic account
prerequisites:
Add new relic repository to ubuntu
echo ‘deb http://apt.newrelic.com/debian/ newrelic non-free’ | sudo tee /etc/apt/sources.list.d/newrelic.list
truest the key
wget -O- https://download.newrelic.com/548C16BF.gpg | sudo apt-key add –
Update the local package list:
sudo apt-get update
install newrelic php agent
sudo apt-get -y install newrelic-php5
works for php but not works for php 8
remove if old with config file
sudo apt-get -y remove –purge newrelic-php5
Please restart your Web server(s) to complete installation.
root@-s-4vcpu-8gb-blr1-01:/etc/php#
root@-s-4vcpu-8gb-blr1-01:/etc/php#
Finish installing the agent:
sudo NR_INSTALL_SILENT=1 newrelic-install install
root@-s-4vcpu-8gb-blr1-01:~# sudo NR_INSTALL_SILENT=1 newrelic-install install
Note: if you enter the license key while installing no need below steps, you can go app and php >> (skip installation and check the data)
Configure your license key and application name
sed -i -e “s/REPLACE_WITH_REAL_KEY/e28947ef70ff6b7baaf50291de3d341c8069NRAL/” \
-e “s/newrelic.appname[[:space:]]=[[:space:]].*/newrelic.appname=\”newwwww\”/” \
-e ‘$anewrelic.distributed_tracing_enabled=true’ \
$(php -r “echo(PHP_CONFIG_FILE_SCAN_DIR);”)/newrelic.ini
-e “s/newrelic.appname[[:space:]]=[[:space:]].*/newrelic.appname=\”newwwww\”/” \
-e ‘$anewrelic.distributed_tracing_enabled=true’ \
$(php -r “echo(PHP_CONFIG_FILE_SCAN_DIR);”)/newrelic.ini
REPLACE_WITH_REAL_KEY
Account 3034122
sed -i -e “s/3034122/e28947ef70ff6b7baaf50291de3d341c8069NRAL/” \
-e “s/newrelic.appname[[:space:]]=[[:space:]].*/newrelic.appname=\”newwwww\”/” \
-e ‘$anewrelic.distributed_tracing_enabled=true’ \
$(php -r “echo(PHP_CONFIG_FILE_SCAN_DIR);”)/newrelic.ini
-e “s/newrelic.appname[[:space:]]=[[:space:]].*/newrelic.appname=\”newwwww\”/” \
-e ‘$anewrelic.distributed_tracing_enabled=true’ \
$(php -r “echo(PHP_CONFIG_FILE_SCAN_DIR);”)/newrelic.ini
Edit newrelic php conf ini
nano /etc/php/7.4/fpm/conf.d/
;newrelic.enabled = true
newrelic.license = “REPLACE_WITH_REAL_KEY”
/etc/phpX.Y/conf.d/newrelic.ini
cd /etc/php/7.4/fpm/conf.d/newrelic.ini
cat /etc/php/7.4/fpm/conf.d/newrelic.ini
cd /etc/php/7.4/conf.d/newrelic.ini
cat /etc/php/7.4/conf.d/newrelic.ini
Restart your application
service php7.4-fpm restart
Check for data
Listening for your data…
Data received successfully.
restart newrelic agent if necessary
service newrelic-infra restart
service newrelic-infra status
systemctl restart newrelic-daemon && systemctl restart php7.4-fpm
uninstall new relic php agent
sudo apt-get -y purge newrelic-php5
$ sudo apt-get autoremove
Troubleshooting errors
if you have php 7.4 and php 8 then remove php 8 or either one of them
apt-get purge php8.0
apt-get purge php8.1
ERROR: unsupported version ‘8.0.3’ of PHP found at:
/usr/bin
Ignoring this particular instance of PHP.
Remove php 8 fpm
apt-get purge php8.0-fpm && apt-get auto-remove
sudo NR_INSTALL_SILENT=1 newrelic-install install
PHP Warning: Module ‘newrelic’ already loaded in Unknown on line 0
remove new relic existing module
newrelic-25
newrelic in every php & apache directory.
new relic php not receiving data
new relic- APm
php agent log
info: attempt daemon connection via ‘@newrelic’
2021-05-14 14:39:00.913 +0000 (24081 24081) info: New Relic 9.17.1.301 (“xigua” – “6498785b65c7”) [daemon=’@newrelic’ php=’8.0.3′ zts=no sapi=’cli’ pid=24081 ppid=24045 uid=0 euid=0 gid=0 egid=0 backtrace=yes startup=agent os=’Linux’ rel=’4.15.0-140-generic’ mach=’x86_64′ ver=’#144-Ubuntu SMP Fri Mar 19 14′ node=’-s-4vcpu-8gb-blr1-01′]
removing “php-wordpress” with run id “BX_xROK_NpQYAC5MCk55UChgnov8AAMBAAAnIQEAAFzpAgROeVAlAwAKOS4xNy4xLjMwMQAULXMtNHZjcHUtOGdiLWJscjEtMDEADXBocC13b3JkcHJlc3M” for lack of activity within 10m0s
warning: User instrumentation from opcache: missing ‘scripts’ key in status information