PHP 8.1 zip module asserting with dependency problem

Bug #1971688 reported by Owen
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
php-defaults (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

When attempting to run certain sites we are getting warning that "PHP Error: Extension zip is not found.". Further examination of the logs reveals this:

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

The file /usr/lib/php/20210902/zip.so does exists. We've uninstalled php8.1-zip and reinstalled it but the same issue happens again.

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: php 2:8.1+92ubuntu1
Uname: Linux 5.17.0-5.1-liquorix-amd64 x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.11-0ubuntu82
Architecture: amd64
CasperMD5CheckResult: unknown
CurrentDesktop: KDE
Date: Thu May 5 10:43:35 2022
InstallationDate: Installed on 2017-12-06 (1610 days ago)
InstallationMedia: Ubuntu 17.10 "Artful Aardvark" - Release amd64 (20171018)
PackageArchitecture: all
SourcePackage: php-defaults
UpgradeStatus: Upgraded to jammy on 2021-12-08 (147 days ago)

Revision history for this message
Owen (osavill-z) wrote :
Revision history for this message
Owen (osavill-z) wrote :

Apparently libzip is not installed but efforts to install libzip-devel result in

The following packages have unmet dependencies.
 libzip-dev : Depends: libzip4 (= 1.7.3-1ubuntu2) but 1:1.0.1-0+16.04+xenial+build6 is to be installed
E: Unable to correct problems, you have held broken packages.

Xenial?!

Revision history for this message
Owen (osavill-z) wrote :

Can't build zip module from source as the package libzip is not installed. Has php8.1-zip been retired? Is there another module I should be using?

Revision history for this message
Owen (osavill-z) wrote :

> dpkg -l | grep xenial
ii diff-pdf 0.2-1~getdeb2~xenial amd64 Simple tool for visually comparing two PDF files
ii libzip4:amd64 1:1.0.1-0+16.04+xenial+build6 amd64 library for reading, creating, and modifying zip archives (runtime)

Downloaded .deb files from launchpad for Hirsute

> apt install libzip-dev_1.7.3-1ubuntu1_amd64.deb libzip4_1.7.3-1ubuntu1_amd64.deb
The following NEW packages will be installed
  libzip-dev
The following packages will be DOWNGRADED:
  libzip4

Downgraded from the Xenial package? Might explain why libzip4 has never been updated since 16.04

Revision history for this message
Owen (osavill-z) wrote :

Built zip module from source and it now all works. Web sites functional and php -m shows no errors or warnings and shows "zip" in the [PHP Modules] section

Revision history for this message
Lena Voytek (lvoytek) wrote :

Hello Owen,

Thank you for providing this report and additional information on building from source. From the warning you provided it states that it cannot find /usr/lib/php/20210902/zip.so.so, while the file that actually exists in the directory is /usr/lib/php/20210902/zip.so. The extra .so extension being looked for may be causing the problem.

When you built the zip module from source, did it provide the file zip.so or zip.so.so?

Thanks!

Revision history for this message
Lena Voytek (lvoytek) wrote :

Also can you attach your /etc/apt/sources.list file and comment the output of

ls /etc/apt/sources.list.d

It's possible that an old version of some modules may have been installed which could cause the issue

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Hi Owen,

Do you have clear steps to reproduce the issue?

php8.1-zip does depend on libzip4 and that should be installed once you install php-zip.

trying to reproduce the issue, I did the following steps:

$ lxc launch ubuntu-daily:jammy php-j
$ lxc exec php-j bash
# apt update
# apt install -y php8.1
# php -m | grep zip

No zip module available here.

# apt install -y php-zip
# php -m | grep zip
zip

Now the module is available.

Then I ran the first example in

https://www.php.net/manual/en/zip.examples.php

(Example #1 Create a Zip archive)

# php test.php
PHP Warning: Undefined variable $thisdir in /root/test.php on line 12
PHP Warning: ZipArchive::addFile(): No such file or directory in /root/test.php on line 12
numfiles: 2
status:0

# apt install -y unzip
# unzip -l test112.zip
Archive: test112.zip
  Length Date Time Name
--------- ---------- ----- ----
       51 2022-05-09 18:52 testfilephp.txt1652122377
       52 2022-05-09 18:52 testfilephp2.txt1652122377
--------- -------
      103 2 files

Do you happen to have multiple versions of php installed locally?

What do you get for
$ namei $(which php)
?

Since there is not enough information in your report to begin triage or to
differentiate between a local configuration problem and a bug in Ubuntu, I
am marking this bug as "Incomplete". We would be grateful if you would:
provide a more complete description of the problem, explain why you
believe this is a bug in Ubuntu rather than a problem specific to your
system, and then change the bug status back to "New".

For local configuration issues, you can find assistance here:
http://www.ubuntu.com/support/community

Changed in php-defaults (Ubuntu):
status: New → Incomplete
Revision history for this message
Owen (osavill-z) wrote :

Hi Lena,

Many thanks for you reply. The only explanation for trying to load zip.so.so I can find is that in the PHP config it was trying to load "extension=zip.so". I have removed the .so and it's still loading the module zip. As the error went away when I built the file from scratch I can't tell if this fixed it or not.

Hi Athos,

Many thanks for your reply. I think my dev machine had got itself in to a bit of a state. I have to support several code bases, some of which that rely on older versions of PHP. This dev machine has been around and updated since 16.04 and had PHP-5.6 and PHP-7.4 installed. Everything is now as it should be, i.e. libzip4 is now from the 22.04 repository, but I don't understand how libzip4_1.7.3-1ubuntu1_amd64.deb, and all other versions since Xenial, would have been considered a downgrade from 1:1.0.1-0+16.04+xenial+build6.

This issue should probably now be closed as referring to packages from a really old setup. The only other package I have from Xenial is diff-pdf

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Hi Owen,

I could not find a libzip4 package whose version is 1:1.0.1-0+16.04+xenial+build6 anywhere in the Ubuntu official archive, so I'm assuming that this is a third-party package you have installed in your system (and as such, we don't provide support for it).

But just to reply to your question, the third-party package you're using has a version that contains an epoch. This is what's causing dpkg to consider it the most recent version of all libzip4 packages you have available to be installed. You can see that by:

$ dpkg --compare-versions '1.7.3-1ubuntu1' gt '1:1.0.1-0+16.04+xenial+build6'
$ echo $?
1

So yeah, dpkg is doing the right thing here; the problem is with the version of the third-party libzip4 package.

Having said all that, and since this is not a problem with an official Ubuntu package, I'm closing this bug as Invalid.

Thanks.

Changed in php-defaults (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
Owen (osavill-z) wrote :

Hi Sergio,

Many thanks for the detailed reply, it makes perfect sense, this must be what happened. Sorry for the false alarm.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.