Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP8: package newrelic-php5 produces error in PHP 8.0.1 after its package received an update #87

Closed
heldchen opened this issue Jan 25, 2021 · 7 comments
Labels
bug Something isn't working CH Community Hero more info requested

Comments

@heldchen
Copy link

heldchen commented Jan 25, 2021

Description

the previous version of newrelic-php5 was still installed for php7.4 on our debian system that runs multiple concurrent php versions (7.4 + 8.0 currently), but for obvious reasons was not active for php 8.0. today the package got updated to 9.16.0.295, and this now causes the php8.0 binary to issue the following error upon startup:

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

Steps to Reproduce

apt-get install newrelic-php5
php -v

Expected Behavior

upgrade of package should not touch configs of unsupported php version 8.0

Relevant Logs / Console output

root@felucia:~# apt-cache policy newrelic-php5 | head
newrelic-php5:
  Installed: 9.16.0.295
  Candidate: 9.16.0.295
  Version table:
 *** 9.16.0.295 500
        500 http://apt.newrelic.com/debian newrelic/non-free amd64 Packages
        100 /var/lib/dpkg/status
     9.15.0.293 500
        500 http://apt.newrelic.com/debian newrelic/non-free amd64 Packages
     9.14.0.290 500
root@felucia:~# apt-cache policy php8.0-cli
php8.0-cli:
  Installed: 8.0.1-1+0~20210112.7+debian10~1.gbp71cd4d
  Candidate: 8.0.1-1+0~20210112.7+debian10~1.gbp71cd4d
  Version table:
 *** 8.0.1-1+0~20210112.7+debian10~1.gbp71cd4d 750
        750 https://packages.sury.org/php buster/main amd64 Packages
        100 /var/lib/dpkg/status
root@felucia:~# php -v

Warning: PHP Startup: Unable to load dynamic library 'newrelic.so' (tried: /usr/lib/php/20200930/newrelic.so (/usr/lib/php/20200930/newrelic.so: cannot open shared object file: No such file or directory), /usr/lib/php/20200930/newrelic.so.so (/usr/lib/php/20200930/newrelic.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 8.0.1 (cli) (built: Jan 12 2021 13:59:46) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.1, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.1, Copyright (c), by Zend Technologies

Your Environment

  • debian 10
  • php 7.4.14
  • php 8.0.1
  • newrelic-php5 9.16.0.295

Additional context

cron-apt update log:

CRON-APT RUN [/etc/cron-apt/config]: Mon Jan 25 22:00:02 CET 2021
CRON-APT SLEEP: 973, Mon Jan 25 22:16:15 CET 2021
CRON-APT ACTION: 3-download
CRON-APT LINE: /usr/bin/apt-get -o quiet=1 dist-upgrade -y -o APT::Get::Show-Upgraded=true --option Dpkg::Options::=--force-confdef --option Dpkg::Options::=--force-confold
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
The following packages will be upgraded:
  mutt newrelic-daemon newrelic-php5 newrelic-php5-common
4 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 17.3 MB of archives.
After this operation, 16.4 kB of additional disk space will be used.
Get:1 http://apt.newrelic.com/debian newrelic/non-free amd64 newrelic-php5-common all 9.16.0.295 [31.1 kB]
Get:2 http://security.debian.org buster/updates/main amd64 mutt amd64 1.10.1-2.1+deb10u5 [1582 kB]
Get:3 http://apt.newrelic.com/debian newrelic/non-free amd64 newrelic-daemon amd64 9.16.0.295 [4355 kB]
Get:4 http://apt.newrelic.com/debian newrelic/non-free amd64 newrelic-php5 amd64 9.16.0.295 [11.3 MB]
apt-listchanges: Reading changelogs...
Preconfiguring packages ...
Fetched 17.3 MB in 0s (44.5 MB/s)
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 134787 files and directories currently installed.)
Preparing to unpack .../newrelic-php5-common_9.16.0.295_all.deb ...
Unpacking newrelic-php5-common (9.16.0.295) over (9.15.0.293) ...
Setting up newrelic-php5-common (9.16.0.295) ...
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 134787 files and directories currently installed.)
Preparing to unpack .../newrelic-daemon_9.16.0.295_amd64.deb ...
Unpacking newrelic-daemon (9.16.0.295) over (9.15.0.293) ...
Setting up newrelic-daemon (9.16.0.295) ...
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 134787 files and directories currently installed.)
Preparing to unpack .../newrelic-php5_9.16.0.295_amd64.deb ...
WARNING: Module newrelic ini file doesn't exist under /etc/php/8.0/mods-available
WARNING: Module newrelic ini file doesn't exist under /etc/php/8.0/mods-available
Unknown PHP version: 8.0
Unpacking newrelic-php5 (9.16.0.295) over (9.15.0.293) ...
Preparing to unpack .../mutt_1.10.1-2.1+deb10u5_amd64.deb ...
Unpacking mutt (1.10.1-2.1+deb10u5) over (1.10.1-2.1+deb10u4) ...
Setting up newrelic-php5 (9.16.0.295) ...
Unknown PHP version: 8.0
Please restart your Web server(s) to complete installation.
Setting up mutt (1.10.1-2.1+deb10u5) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for mime-support (3.62) ...
Processing triggers for systemd (241-7~deb10u5) ...

Running kernel seems to be up-to-date.

Services to be restarted:
 systemctl restart exim4.service
 systemctl restart nmbd.service
 systemctl restart php7.4-fpm.service
 systemctl restart smbd.service
 systemctl restart winbind.service

No containers need to be restarted.

No user sessions are running outdated binaries.```
@heldchen heldchen added the bug Something isn't working label Jan 25, 2021
@heldchen
Copy link
Author

heldchen commented Jan 25, 2021

the installer seems to have left a broken symlink in /usr/lib/php. it points to /usr/lib/newrelic-php5/agent/x64/newrelic-.so without any of the versioning information:

root@felucia:~# ls -al /usr/lib/php/
total 96
drwxr-xr-x 11 root root  4096 Jan 25 22:16 .
drwxr-xr-x 68 root root 20480 Dez  5 22:46 ..
drwxr-xr-x  2 root root  4096 Jan  1 22:08 20131226
drwxr-xr-x  2 root root  4096 Jan  1 22:08 20151012
drwxr-xr-x  2 root root  4096 Jan  1 22:08 20160303
drwxr-xr-x  2 root root  4096 Jan  1 22:08 20170718
drwxr-xr-x  2 root root  4096 Jan  1 22:08 20180731
drwxr-xr-x  2 root root  4096 Jan 25 22:16 20190902
drwxr-xr-x  2 root root  4096 Jan 12 22:47 20200930
drwxr-xr-x  3 root root  4096 Jan 12 22:47 7.4
drwxr-xr-x  3 root root  4096 Jan 12 22:47 8.0
lrwxrwxrwx  1 root root    45 Jan 25 22:16 newrelic.so -> /usr/lib/newrelic-php5/agent/x64/newrelic-.so
-rwxr-xr-x  1 root root   309 Jan 12 14:59 php7.4-fpm-reopenlogs
-rwxr-xr-x  1 root root   309 Jan 12 14:59 php8.0-fpm-reopenlogs
-rwxr-xr-x  1 root root   514 Feb 21  2020 php-fpm-socket-helper
-rw-r--r--  1 root root  4845 Aug 14  2019 php-helper
-rw-r--r--  1 root root  9234 Jan 22  2020 php-maintscript-helper
-rwxr-xr-x  1 root root  2922 Aug 14  2019 sessionclean

and the .so version 20200930 was not installed:

root@felucia:~# ls -al /usr/lib/newrelic-php5/agent/x64/
total 30552
drwxr-xr-x 2 root root    4096 Jan 25 22:16 .
drwxr-xr-x 3 root root    4096 Feb 12  2019 ..
-rw-r--r-- 1 root root 1709137 Jan 22 04:02 newrelic-20090626.so
-rw-r--r-- 1 root root 1710007 Jan 22 04:02 newrelic-20090626-zts.so
-rw-r--r-- 1 root root 1717696 Jan 22 04:02 newrelic-20100525.so
-rw-r--r-- 1 root root 1721840 Jan 22 04:02 newrelic-20100525-zts.so
-rw-r--r-- 1 root root 1725720 Jan 22 04:02 newrelic-20121212.so
-rw-r--r-- 1 root root 1729910 Jan 22 04:02 newrelic-20121212-zts.so
-rw-r--r-- 1 root root 1726489 Jan 22 04:02 newrelic-20131226.so
-rw-r--r-- 1 root root 1730534 Jan 22 04:02 newrelic-20131226-zts.so
-rw-r--r-- 1 root root 1735702 Jan 22 04:02 newrelic-20151012.so
-rw-r--r-- 1 root root 1746211 Jan 22 04:02 newrelic-20151012-zts.so
-rw-r--r-- 1 root root 1735631 Jan 22 04:02 newrelic-20160303.so
-rw-r--r-- 1 root root 1746196 Jan 22 04:02 newrelic-20160303-zts.so
-rw-r--r-- 1 root root 1735644 Jan 22 04:02 newrelic-20170718.so
-rw-r--r-- 1 root root 1746273 Jan 22 04:02 newrelic-20170718-zts.so
-rw-r--r-- 1 root root 1732329 Jan 22 04:02 newrelic-20180731.so
-rw-r--r-- 1 root root 1743918 Jan 22 04:02 newrelic-20180731-zts.so
-rw-r--r-- 1 root root 1730252 Jan 22 04:02 newrelic-20190902.so
-rw-r--r-- 1 root root 1740977 Jan 22 04:02 newrelic-20190902-zts.so

@heldchen heldchen changed the title PHP8: package newrelic-php5 fails to load with PHP 8.0.1 PHP8: package newrelic-php5 produces error in PHP 8.0.1 after its package received an update Jan 25, 2021
@GwynethLlewelyn
Copy link

AFAIK, New Relic hasn't rolled out support for PHP 8.0 yet. I have exactly the same issue as you do (including that broken link you mention) under Ubuntu 20.04.2 LTS — similar to Debian, after all. The New Relic installation package goes through all previous (i.e. non-PHP8) libraries but it skips 20200930 (= PHP 8.0). However, it does not remove the configuration from /etc/php/8.0/mods-available/.

Under that directory, you should open newrelic.ini, scroll down a bit until you find the line

extension = "newrelic.so"

and just comment it. There, your error is gone. Of course, you won't have the New Relic agent in PHP 8.0, so, as per their suggestion, keep following #35 until they announce PHP 8.0 support.

Note: sometimes, you can use 'older' libraries in newer versions of PHP and get some amount of 'crippled' functionality back. I've tried to symlink the newrelic-20190902.so and newrelic-20190902-zts.so inside /usr/lib/php/20200930 — but this will not work, the error being (/usr/lib/php/20200930/newrelic.so: undefined symbol: zif_display_disabled_function) — tough luck! We just have to be patient and wait...

@jodeev jodeev added the CH Community Hero label Mar 3, 2021
@jodeev jodeev added this to Triage - tag + prioritize. in PHP/C Engineering Board Mar 3, 2021
@zsistla
Copy link
Contributor

zsistla commented Mar 3, 2021

Hi @heldchen,

Thank you for your details about this issue!

Regarding the symlink issue, can you let us know what version of Python you are using?

We've seen similar symlink issues on systems using Python 2. Starting with the PHP Agent 9.10.0.262, The PHP Agent installer for Ubuntu/Debian systems now requires Python 3. Debian based distributions with Python 2 are no longer supported.

Regarding the PHP 8.0 support, we are diligently working on this, and please keep watching #35 for official PHP 8.0 agent and agent installation support.

@heldchen
Copy link
Author

heldchen commented Mar 4, 2021

@zsistla Debian 10 ("Buster") has /usr/bin/python mapped to v2.7.16 per default but also comes with v3.7.3. as that the previous agent version (9.15.0.293) installed fine I'd say python3 is properly available on the affected system and the dangling symlink is not related to python2?

@zsistla
Copy link
Contributor

zsistla commented Mar 4, 2021

@heldchen, thank you for the update and for engaging with us to work through the issue.

Was 9.15.0.293 the first install on the system? We've seen the issue occur for reinstallations.
For example, we first encountered it on a reinstall on Ubuntu 16.04 which by default ships with with Python 2.7 and Python 3.5. Even though Python3 was on the system, because it wasn't the default Python, it caused errors and broke the symlink.

That being said, we are still working on PHP 8 support, including installation on systems where PHP is present.

@heldchen
Copy link
Author

heldchen commented Mar 4, 2021

no, this server has been running php 7.x and the newrelic php agent for multiple years.

zsistla added a commit to zsistla/docs-website that referenced this issue Aug 23, 2021
---
subject: PHP agent
releaseDate: '2021-08-23'
version: 9.18.1.303
downloadLink: 'https://download.newrelic.com/php_agent/archive/9.18.1.303'
---

## New Relic PHP Agent v9.18.1 ##

### New Features ###
* [Added](newrelic/newrelic-php-agent#162) a docker development environment. It's now possible for contributors to both develop and test (unit tests and integration tests) without setting up a specific environment on their own system. Please see our [documentation](https://github.com/newrelic/newrelic-php-agent/blob/main/docs/dev_environment.md) for more information.
* [Route caching in `Laravel 7.x` is now supported!](newrelic/newrelic-php-agent#174). Transaction naming now works with routes cached via `php artisan route:cache`. @stockalexander, thanks for your contribution!
* `Redis::mget` and `Redis::mset` [functions are now supported](newrelic/newrelic-php-agent#156). @b-viguier, thanks for your contribution!

### Bug Fixes ###
* [Fixed](newrelic/newrelic-php-agent#161) instances where a memory leak was occurring with our `curl multi` instrumentation.
* [Fixed](newrelic/newrelic-php-agent#176) an issue where a supportability metric used to track an edge case was causing a segfault.
* [Fixed](newrelic/newrelic-php-agent#87) an issue where PHP versions with an unknown API version were incorrectly handled during Debian package install.
* [Fixed](newrelic/newrelic-php-agent#164) instances where `parent.transportDuration` values are `0` for transactions between two PHP applications instrumented through distributed tracing. @b-viguier, thanks for your contribution!
* [Fixed](newrelic/newrelic-php-agent#158) an issue where the `newrelic.ini` configuration file was incorrectly installed. @b-viguier, thanks for your contribution!

### Support Statement ###
* New Relic recommends that you upgrade the agent regularly and at a minimum every 3 months. As of this release, the oldest supported version is [8.6.0](/docs/release-notes/agent-release-notes/php-release-notes/php-agent-860238/).
zuluecho9 pushed a commit to zsistla/docs-website that referenced this issue Aug 23, 2021
---
subject: PHP agent
releaseDate: '2021-08-23'
version: 9.18.1.303
downloadLink: 'https://download.newrelic.com/php_agent/archive/9.18.1.303'
---

## New Relic PHP Agent v9.18.1 ##

### New Features ###
* [Added](newrelic/newrelic-php-agent#162) a docker development environment. It's now possible for contributors to both develop and test (unit tests and integration tests) without setting up a specific environment on their own system. Please see our [documentation](https://github.com/newrelic/newrelic-php-agent/blob/main/docs/dev_environment.md) for more information.
* [Route caching in `Laravel 7.x` is now supported!](newrelic/newrelic-php-agent#174). Transaction naming now works with routes cached via `php artisan route:cache`. @stockalexander, thanks for your contribution!
* `Redis::mget` and `Redis::mset` [functions are now supported](newrelic/newrelic-php-agent#156). @b-viguier, thanks for your contribution!

### Bug Fixes ###
* [Fixed](newrelic/newrelic-php-agent#161) instances where a memory leak was occurring with our `curl multi` instrumentation.
* [Fixed](newrelic/newrelic-php-agent#176) an issue where a supportability metric used to track an edge case was causing a segfault.
* [Fixed](newrelic/newrelic-php-agent#87) an issue where PHP versions with an unknown API version were incorrectly handled during Debian package install.
* [Fixed](newrelic/newrelic-php-agent#164) instances where `parent.transportDuration` values are `0` for transactions between two PHP applications instrumented through distributed tracing. @b-viguier, thanks for your contribution!
* [Fixed](newrelic/newrelic-php-agent#158) an issue where the `newrelic.ini` configuration file was incorrectly installed. @b-viguier, thanks for your contribution!

### Support Statement ###
* New Relic recommends that you upgrade the agent regularly and at a minimum every 3 months. As of this release, the oldest supported version is [8.6.0](/docs/release-notes/agent-release-notes/php-release-notes/php-agent-860238/).
@mfulb
Copy link
Contributor

mfulb commented Feb 15, 2022

PHP 8.0 support has been released so that ought to address this issue.

@mfulb mfulb closed this as completed Feb 15, 2022
PHP/C Engineering Board automation moved this from Triage - tag + prioritize. to Done Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CH Community Hero more info requested
Projects
Development

No branches or pull requests

5 participants