Topic: php 7.3.32 : zip not found as non-root user

Hello,

I am under Centos 7.9

If I run the following php command as root user, I receive a message with no error :

# php --ri zip

zip

Zip => enabled
Zip version => 1.19.2
Libzip version => 1.7.3
BZIP2 compression => Yes
XZ compression => Yes
ZSTD compression => No
AES-128 encryption => Yes
AES-192 encryption => Yes
AES-256 encryption => Yes

But the same command as non-root user returns an error message :

$  php --ri zip
PHP Warning:  PHP Startup: Unable to load dynamic library 'zip.so' (tried: /usr/lib64/php/modules/zip.so (/usr/lib64/php/modules/zip.so: undefined symbol: zip_register_cancel_callback_with_state), /usr/lib64/php/modules/zip.so.so (/usr/lib64/php/modules/zip.so.so: undefined symbol: zip_register_cancel_callback_with_state)) in Unknown on line 0
Extension 'zip' not present.

It only happens with the zip extension.

Has anybody an idea on how to solve this ?

Regards,

Alain

Re: php 7.3.32 : zip not found as non-root user

Looks like a path issue.

$ which php


will give you path to used command
Probably something manually installed in /usr/local/bin

Desktop: Fedora 35 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 34 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: php 7.3.32 : zip not found as non-root user

For memory, latest version is 1.20.0 for the extension, and 1.8.0 for the library

$ php --ri zip

zip

Zip => enabled
Zip version => 1.20.0
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

Please check what is installed.

Desktop: Fedora 35 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 34 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: php 7.3.32 : zip not found as non-root user

Thank you for the answers.
I followed the wizard to install and enable php 7.4 only on our very simple installation : Centos 7.9 with two users (let's say user1 and user2) outside root.

After installation, when connected as root as well as user1 gives :

php -v
PHP Warning:  PHP Startup: Unable to load dynamic library 'zip' (tried: /usr/lib
64/php/modules/zip (/usr/lib64/php/modules/zip: cannot open shared object file:
No such file or directory), /usr/lib64/php/modules/zip.so (/usr/lib64/php/module
s/zip.so: undefined symbol: zip_register_cancel_callback_with_state)) in Unknown
 on line 0
PHP 7.4.25 (cli) (built: Oct 19 2021 15:18:10) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.25, Copyright (c), by Zend Technologies

But connected as user2 :

[user2]$ php -v
PHP 7.4.25 (cli) (built: Oct 19 2021 15:18:10) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.25, Copyright (c), by Zend Technologies

Once connected as user2, if I make a su root, php -v returns no error!!

I checked the different permissions and path. I see no difference. The command "which php" returns the same name.

php --ri zip shows zip version 1.20.0 and libzip 1.8.0 as expected.

phpinfo called from the website does not mention any problem.

I can't find why php find the zip library with one user and not the other, specially root.

And of course, I need to call the php command from user1 !!!

So I'm stuck with the problem.

Regards

Re: php 7.3.32 : zip not found as non-root user

> undefined symbol: zip_register_cancel_callback_with_state

This mean the extension find an old version of the library.

So there must have something in the env different

please, post output of

$ rpm -qa 'php*' '*zip' | sort
$ locate libzip.so.5
or if previous fails (no updatedb run)
$ find / -name libzip.so.5

Can also check how LD_LIBRARY_PATH is set (may point to old version directory)

Desktop: Fedora 35 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 34 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: php 7.3.32 : zip not found as non-root user

May also help

$ ldd /usr/lib64/php/modules/zip.so 
...
    libzip.so.5 => /lib64/libzip.so.5 (0x00007fde4aab7000)
Desktop: Fedora 35 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 34 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: php 7.3.32 : zip not found as non-root user

Many, many thanks!!

With

$ find / -name libzip.so.5

, I found that I had tow version of libzip.so.5 :

/usr/lib64/libzip.so.5
/usr/local/lib/libzip.so.5

lrwxrwxrwx. 1 root root     13 10 nov.  09:19 /usr/lib64/libzip.so.5 -> libzip.so.5.4
-rwxr-xr-x. 1 root root 126664 21 juin  14:52 /usr/lib64/libzip.so.5.4
# ls -l /usr/local/lib/libzip.so*
lrwxrwxrwx. 1 root root     15 10 juil.  2017 /usr/local/lib/libzip.so -> libzip.so.5.0.0
-rwxr-xr-x. 1 root root 725504 10 juil.  2017 /usr/local/lib/libzip.so.5.0.0

And LD_LIBRARY_PATH was pointing on /usr/local/lib
So it was calling an old version of libzip

Thanks for support!
Alain

Re: php 7.3.32 : zip not found as non-root user

smile

Desktop: Fedora 35 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 34 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi