PHP Startup: Unable to load dynamic library (NEW RELIC)
Asked Answered
A

4

11

I am running Ubuntu 12.04 with Nginx and the latest PHP. The story goes like this: I tried to install the new relic PHP agent per the instructions for ubuntu:

wget -O - http://download.newrelic.com/548C16BF.gpg | sudo apt-key add -

sudo sh -c 'echo "deb http://apt.newrelic.com/debian/ newrelic non-free" 
> /etc/apt /sources.list.d/newrelic.list'

sudo apt-get update
sudo apt-get install newrelic-php5
sudo newrelic-install install

And it doesn't work. After everything the PHP agent simply can't start. I even whipped up a quick phpinfo.php page to see if the newrelic module was listed and it's not. So then I googled "New relic .deb" and came across this page: https://docs.newrelic.com/docs/server/server-monitor-installation-ubuntu-and-debian and followed the instructions. The install all goes through but the agent also doesn't start. I like to keep my servers clean so I decided "OK, since it doesn't work, until new relic support gets back to me and I can start from fresh I will remove the new relic stuff that was installed". So once again I followed the instructions on that link. The install seemed to work normally. However, if I execute the command "PHP" I get the following error:

root@MYHOSTNAME:/home# php
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212
/newrelic.so' - /usr/lib/php5/20121212/newrelic.so: cannot open shared object file:
No such file or directory in Unknown on line 0

I made sure there is no reference to newrelic in my /etc/php/fpm/php.ini file and double checked to see if there was anything in that folder. Nothing.

So my question is: how do I get rid of the error? How do I make PHP stop trying to load that newrelic.so module? Is there any reference to it somewhere that I might be missing?

Anaesthetize answered 2/11, 2013 at 8:4 Comment(4)
Did you restart nginx?Bjork
Also, did you check the /conf.d folder for any additional .ini files?Bjork
@WayneWhitty yep, restarted nginx and php. Also checked the conf.d folder and there are no newrelic modules in there. Thanks for the suggestions.Anaesthetize
What does Additional .ini files parsed say in php info?Bjork
A
27

Ok, I found the answer. I can't describe how grateful I am to @mike in the following post: Error In PHP5 ..Unable to load dynamic library. I ran $ grep -Hrv ";" /etc/php5 | grep -i "extension=" and it returned a large list of files and one of them was newrelic.ini in /etc/php5/cli/conf.d/ which to be honest with you I wasn't even aware was a php directory. So I ran sudo rm -rf /etc/php5/cli/conf.d/newrelic.ini and restarted nginx and php5-fpm, and problem solved :)

Thanks @WayneWhitty for the suggestions! I am also going to let newrelic know that they should fix that on their uninstall script.

Anaesthetize answered 2/11, 2013 at 8:53 Comment(5)
That's the /conf.d/ directory that I was talking about. Really, I shouldn't have made assumptions, seeing as Nginx also has a conf.d folder.Bjork
this was very helpful. Newrelic should fix that on their uninstall script.Clark
newrelic sucks with their uninstall - their docs say to restart the server after uninstallingFurriery
Great, it helped me after trying for a long time to get rid of newrelic's background services. For CentOS rm -rf /usr/local/lib/php.ini.d/newrelic.iniCrawford
This saves me some headacheRare
B
5
  1. Make sure that you check the /conf.d folder for PHP. If there are any .ini files there, they will be automatically parsed. If you see anything relating to newrelic, remove it. In your php info file, search for Additional .ini files parsed if you want to see what .ini files have been automatically loaded on startup.
  2. Restart Nginx.
Bjork answered 2/11, 2013 at 8:8 Comment(1)
Here is the full list: /etc/php5/fpm/conf.d/05-opcache.ini, /etc/php5/fpm/conf.d/10-pdo.ini, /etc/php5/fpm/conf.d/20-apcu.ini, /etc/php5/fpm/conf.d/20-curl.ini, /etc/php5/fpm/conf.d/20-gd.ini, /etc/php5/fpm/conf.d/20-imap.ini, /etc/php5/fpm/conf.d/20-json.ini, /etc/php5/fpm/conf.d/20-mcrypt.ini, /etc/php5/fpm/conf.d/20-memcache.ini, /etc/php5/fpm/conf.d/20-mysql.ini, /etc/php5/fpm/conf.d/20-mysqli.ini, /etc/php5/fpm/conf.d/20-pdo_mysql.ini, /etc/php5/fpm/conf.d/20-readline.ini, /etc/php5/fpm/conf.d/20-xmlrpc.ini Anaesthetize
M
2

On PHP7 CLI, remove /etc/php/7.0/cli/conf.d/newrelic.ini

Mchugh answered 29/7, 2017 at 22:12 Comment(0)
H
1

I received the same kind of error when tried to install New Relic for Docker. I was trying to install it for alpine docker image and used default Linux release, but you should use -musl release instead.

According to this response from newrelic forum:

Alpine linux has a different C compiler called musl that causes the daemon to fail to start if it is compiled with the standard libc compiler.

https://www.musl-libc.org/intro.html 13

For this, we have a separate installer compiled for Alpine linux here:

http://download.newrelic.com/php_agent/release/newrelic-php5-8.6.0.238-linux-musl.tar.gz

Source

Releases

Hobbs answered 27/6, 2020 at 17:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.