Topic: php74-php-pecl-zip fails with undefined symbol

Using it under CentOS 8 will fails with:

01-Jul-2021 11:59:02 UTC] {"reqId":"YN2uBpv0vrUymNQiyHZ34wAAAAA","level":3,"time":"2021-07-01T11:59:02+00:00","remoteAddr":"XX.XX.XX.XX.XX","user":"--","app":"PHP","method":"GET","url":"/","message":"PHP Startup: Unable to load dynamic library 'zip.so' (tried: /opt/remi/php74/root/usr/lib64/php/modules/zip.so (/opt/remi/php74/root/usr/lib64/php/modules/zip.so: undefined symbol: zip_register_cancel_callback_with_state), /opt/remi/php74/root/usr/lib64/php/modules/zip.so.so (/opt/remi/php74/root/usr/lib64/php/modules/zip.so.so: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0","version":""}

installed php packages:
php74-php-gd-7.4.21-1.el8.remi.x86_64
php74-php-pecl-igbinary-3.2.3-1.el8.remi.x86_64
php74-php-intl-7.4.21-1.el8.remi.x86_64
php74-php-pecl-zip-1.19.3-2.el8.remi.x86_64
php74-php-fpm-7.4.21-1.el8.remi.x86_64
php74-php-xml-7.4.21-1.el8.remi.x86_64
php74-php-json-7.4.21-1.el8.remi.x86_64
php74-libzip-1.8.0-1.el8.remi.x86_64
php74-php-ldap-7.4.21-1.el8.remi.x86_64
php74-php-mbstring-7.4.21-1.el8.remi.x86_64
php74-php-common-7.4.21-1.el8.remi.x86_64
php74-php-pecl-imagick-im7-3.5.0-1.el8.remi.x86_64
php74-php-pecl-redis5-5.3.4-1.el8.remi.x86_64
php74-php-pdo-7.4.21-1.el8.remi.x86_64
oniguruma5php-6.9.7.1-1.el8.remi.x86_64
php74-php-mysqlnd-7.4.21-1.el8.remi.x86_64
php74-php-cli-7.4.21-1.el8.remi.x86_64
php74-runtime-1.0-3.el8.remi.x86_64
php74-php-pecl-msgpack-2.1.2-1.el8.remi.x86_64

ldd:
ldd /opt/remi/php74/root/usr/lib64/php/modules/zip.so
    linux-vdso.so.1 (0x00007f6da6218000)
    libzip.so.5 => /opt/remi/php74/root/usr/lib64/libzip.so.5 (0x00007f6da5bbc000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f6da57f7000)
    libbz2.so.1 => /lib64/libbz2.so.1 (0x00007f6da55e6000)
    liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f6da53bf000)
    libzstd.so.1 => /lib64/libzstd.so.1 (0x00007f6da511f000)
    libcrypto.so.1.1 => /lib64/libcrypto.so.1.1 (0x00007f6da4c37000)
    libz.so.1 => /lib64/libz.so.1 (0x00007f6da4a20000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f6da5fee000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f6da4800000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f6da45fc000)

Under CentOS7 all works.

Re: php74-php-pecl-zip fails with undefined symbol

Sorry, but cannot reproduce:

# rpm -qf /opt/remi/php74/root/usr/lib64/php/modules/zip.so
php74-php-pecl-zip-1.19.3-2.el8.remi.x86_64

# ldd /opt/remi/php74/root/usr/lib64/php/modules/zip.so
         ...
    libzip.so.5 => /opt/remi/php74/root/usr/lib64/libzip.so.5 (0x00007f471bbc0000)
         ...

# rpm -qf /opt/remi/php74/root/usr/lib64/libzip.so.5
php74-libzip-1.8.0-1.el8.remi.x86_64

# rpm -q --requires php74-php-pecl-zip
...
php74-libzip(x86-64) >= 1.8.0
...

# php74 --ri zip

zip

Zip => enabled
Zip version => 1.19.3
Libzip version => 1.8.0
BZIP2 compression => Yes
XZ compression => Yes
ZSTD compression => Yes
AES-128 encryption => Yes
AES-192 encryption => Yes
AES-256 encryption => Yes
Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: php74-php-pecl-zip fails with undefined symbol

And do you really need multiple PHP versions ?

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: php74-php-pecl-zip fails with undefined symbol

Can you please explain your configuration, how PHP vas installed, and how PHP script are run.

I don't understand from which app using json format your log is from

Which PHP stream version is enabled ?

May help:

# dnf module list php
# rpm -qa \*php\* | sort

It looks like something load the old libzip from the RHEL default stream (php:7.2)
So a workaround may be to switch to a more recent php stream, and update libzip (the one in default system) to 1.8.0

# dnf module reset php
# dnf module enable php:remi-7.4
# dnf update libzip

BTW,
* If you don't need multiple versions, it is far simpler, and avoid such issue, to use "single version" as described by the wizard (link in the top right corner of all pages).
* If you need multiple versions, it is recommended to use a recent version from my repo as the default one (and older as "multiple version" / SCL)

In both cases, this will pull the latest libzip in the system.

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: php74-php-pecl-zip fails with undefined symbol

Thanks to mail from another user, I was able to reproduce
This will be tracked as https://github.com/remicollet/remirepo/issues/182

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: php74-php-pecl-zip fails with undefined symbol

Fixed using php74-php-pecl-zip-1.19.3-3.el8.remi.x86_64

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: php74-php-pecl-zip fails with undefined symbol

Thanks, today I was back in the office and I can confirm, that php74-php-pecl-zip-1.19.3-3.el8.remi.x86_64 will fix it.

Re: php74-php-pecl-zip fails with undefined symbol

smile

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi