Yesterday I was trying to install the PHP monitor from New Relic. If you don’t know New Relic, and you need something quick to get you started with monitoring for free, go check them out.
They have a general system monitor for hardware resources (with alerts) but more interestingly, you can monitor your PHP applications with a special daemon you install as a PHP module on top of Apache.
The PHP monitoring daemon is compromised of 2 parts – the PHP extension and the New Relic daemon which operates like a proxy between PHP and the New Relic servers.
Problem was I couldn’t get the PHP extension to talk with the New Relic daemon. After turning on verbose debugging, log file was showing the following error:
verbosedebug: RINIT processing started verbosedebug: daemon connect(fd=13 uds=/tmp/.newrelic.sock) returned -1 errno=ENOENT warning: daemon connect(fd=13 uds=/tmp/.newrelic.sock) returned -1 errno=ENOENT. Failed to connect to the newrelic-daemon. Please make sure that there is a properly configured newrelic-daemon running. For additional assistance, please see: https://newrelic.com/docs/php/newrelic-daemon-startup-modes debug: unable to begin transaction: no daemon connection
After spending some considerable amount of time on googling this error, playing with file permissions, switching from UNIX file socket to TCP ports and restarting the Apache webserver I realized that the New Relic daemon (the proxy) has 2 modes of startup operation:
- Started by Apache
- Started by init script
I didn’t want to switch from the Apache startup method to init script in order not to complicate the environment so I switched again to TCP port, stopped Apache completely and manually killed the New Relic proxy daemon. (kill -9) Viola! problem solved.
Turns out that when I restarted Apache (apachectl restart) It didn’t killed the New Relic process, which probably caused this issue.