Skip to content
Advertisement

docker php8.0-apache new relic – Unable to load dynamic library ‘newrelic.so’

I’m trying to run new relic in docker with php8.0-apache image.

I follow instruction by:

https://docs.newrelic.com/docs/agents/php-agent/advanced-installation/docker-other-container-environments-install-php-agent/

When I start container and see PHP warning

Warning: PHP Startup: Unable to load dynamic library 'newrelic.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20200930/newrelic.so (/usr/local/lib/php/extensions/no-debug-non-zts-20200930/newrelic.so: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20200930/newrelic.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20200930/newrelic.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

Dockerfile:

FROM php:8.0-apache

RUN curl -L https://download.newrelic.com/php_agent/release/newrelic-php5-9.18.1.303-linux.tar.gz | tar -C /tmp -zx &&    export NR_INSTALL_USE_CP_NOT_LN=1 &&    export NR_INSTALL_SILENT=1 &&    /tmp/newrelic-php5-*/newrelic-install install &&    rm -rf /tmp/newrelic-php5-* /tmp/nrinstall*

RUN sed -i 
      -e 's/"REPLACE_WITH_REAL_KEY"/"COMPANY-KEY"/' 
      -e 's/newrelic.appname = "PHP Application"/newrelic.appname = "company-test"/' 
      -e 's/;newrelic.daemon.app_connect_timeout =.*/newrelic.daemon.app_connect_timeout=15s/' 
      -e 's/;newrelic.daemon.start_timeout =.*/newrelic.daemon.start_timeout=5s/' 
      /usr/local/etc/php/conf.d/newrelic.ini

Thank you for any help.

Advertisement

Answer

check if there is any newrelic.ini file and remove it.

navigate to /etc/php5/cli/conf.d/ and delete all corresponding *.ini files.

This should resolve your problem.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement