DEV Community

pallade
pallade

Posted on

New Relic and php-fpm on Ubuntu

This is a sad story of a great service with very poor documentation and abysmal customer support.

When installing New Relic agent, it will not work out of the box.

How to debug:

  1. When you install the deb repository, remember do replace http with https. Otherwise the repository will not load:
    Failed to fetch http://apt.newrelic.com/debian/dists/newrelic/InRelease 301 Moved Permanently

  2. Check your INI files. Use phpinfo() and find out if the module for newrelic is loaded.

  3. Go to /var/log/newrelic/php_agent.log. There should be lines there. For example:

2023-04-28 10:30:39.288 +0200 (2312 2312) info: New Relic 10.9.0.324 ("lilac" - "d563196dce79") [daemon='@newrelic' php='8.2.5' zts=no sapi='fpm-fcgi' pid=2312 ppid=1 uid=0 euid=0 gid=0 egid=0 backtrace=yes startup=agent os='Linux' rel='5.15.0-71-generic' mach='x86_64' ver='#78-Ubuntu SMP Tue Apr 18 09' node='XXX']

You should see things related to your SAPI, in my case php-fpm. If you are using fpm and you see things related to apache2 sapi, then you have some issues. Maybe you are loading modphp and you forgot to disable it?

  1. If you still see nothing on new relic, then check Apparmor. Is it enabled? Is php-fpm in enforce mode? If so, you need to add this line to /etc/apparmor.d/php-fpm:

/proc/*/statm r,

then call service apparmor reload to reload all profiles.

Top comments (0)