I want to use http://php.net/manual/en/ziparchive.setencryptionname.php but this relies on libzip version 1.2 being available. On Debian, a $ dpkg -s libzip-dev prints

Package: libzip-dev
Status: install ok installed
Source: libzip
Version: 1.1.3-1+0~20170825111722.1+jessie~1.gbp254624
Depends: libzip4 (= 1.1.3-1+0~20170825111722.1+jessie~1.gbp254624), zlib1g-dev

For encryption to be available, I nee libzip >= 1.2. How do I get that?

Same problem applies to my local dev machine where I have PHP installed via homebrew as well as libzip which is listed as being version 1.3.0:

$ brew install libzip
> Warning: libzip 1.3.0 is already installed

What do I have to do in both cases?

  • Did you ever figure out how to do this? I have the same problem. – Tom Jun 20 '18 at 19:48
  • 1
    unfortunately not @tom; I am even not sure what I eventually did. I guess it was for local (unit) testing and I just let it be… – Adrian Föder Jun 21 '18 at 10:23

You must be running a very old version of Debian. I'm running recent Ubuntu, which derives from Debian + here's what I see...

lxd: net11-zesty # dpkg -l |  grep zlib
ii  zlib1g:amd64                       1:1.2.11.dfsg-0ubuntu1                  amd64        compression library - runtime
ii  zlib1g-dev:amd64                   1:1.2.11.dfsg-0ubuntu1                  amd64        compression library - development

So to fix your Debian install, upgrade Debian + latest zlib will install.

I you must build from scratch, use the LFS Build Instructions + be aware of problems. If you install zlib-1.2 over the top of your system zlib-1.3, likely you'll have many problems + may break your reboots.

Install this library someplace like /opt or /usr/local + build your PHP extension from source, using the zlib-1.2 install directory.

For your local machine, you'll do the same. I'm guessing your using Macs, since you mention brew. You'll have to be very careful here also, as trying to build one new library, hopefully will trigger rebuilding or relinking all code which depends on this library.

I use Macports as the dependency mechanism seems to work better.

If I were using brew, I'd like remove all code installed by brew + reinstall all brew built code. This should pick up all latest code, including zlib.

Last item. Since your trying to build a PHP extension, I'd strongly suggest you'll save your time + sanity by starting with a fresh, updated OS (like Ubuntu Zesty) + LAMP Stack, so you have latest Apache-2.4.29 + PHP-7.1.11 as your starting point. Then you can just install packages from normal PPAs + your problem will resolve itself with no source building.

  • thank you very much for your elaborate answer. However, $ dpkg -l | grep zlib gives 1:1.2.8.dfsg-2+b1 on my system as well; but I am looking for libzip being at version 1.2. Is it maybe just not available when looking at packages.debian.org/de/jessie/libzip-dev ? – Adrian Föder Nov 6 '17 at 14:02
  • The above says you have v1.2.8 installed. If you're saying your tried to downlevel to install a bugger v1.2.0 version... not recommended... Your OS version will contain fixes which zlib should have installed, as so many packages rely on zlib. If you downlevel zlib, then you'll be reinstalling fixed bugs. – David Favor Nov 7 '17 at 14:31
  • I think you confuse zlib with libzip? – Adrian Föder Nov 8 '17 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.