0

I am attempting to install the php zip plugin

I run:

sudo apt-get install php-zip (also php7.0-zip) 

I get dependency missing return for libzip4 (>=1.0), yet when I attempt to install or update libzip4 via apt-get - it shows I have 1.0.1 installed (I think it may have package name or an alias of libzip4:i386 -> not sure if that is related to this problem or not but the naming convention looks odd to me in comparison to the other php plugins I have installed).

Terminal commands with output:

sudo apt-get install php-zip

Reading package lists... Done Building dependency tree
Reading state information... Done Note, selecting 'php7.0-zip' instead of 'php-zip' Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:

The following packages have unmet dependencies: php7.0-zip : Depends: libzip4 (>= 1.0) but it is not installable

E: Unable to correct problems, you have held broken packages.

&&:

sudo apt-get install libzip4

Reading package lists... Done Building dependency tree
Reading state information... Done libzip4:i386 is already the newest version (1.0.1-0ubuntu1). 0 upgraded, 0 newly installed, 0 to remove and 20 not upgraded.

SYSTEM:

Lenovo G500s running Ubuntu Xenial 16.04 desktop vanilla install php/apache2 standard build (stock Ubuntu LAMP stack) php version: 7.0.15-0ubuntu0.16.04.4

Any help greatly appreciated!!

EDIT: I have also tried to install (I believe it's the same plugin) with PECL :

sudo pecl install zip

downloading zip-1.14.0.tgz ... Starting to download zip-1.14.0.tgz (248,476 bytes) ..............................done: 248,476 bytes 8 source files, building running: phpize sh: 1: phpize: not found ERROR: `phpize' failed

-1

libzip4:i386 is a 32-bit package. and conflicts with 64-bit version. are you using a 32-bit computer?

if you are using 64-bit then do:
sudo apt-get purge libzip4

then:
sudo apt-get install php-zip

if you are using 32-bit then:
sudo apt-get install php-zip:i386

  • You are a legend! – MJHd Jul 7 '17 at 23:32
3

To install libzip4, you have to add the Ubuntu repositories to your apt source list. This can be done by

sudo apt-add-repository main
sudo apt-add-repository restricted
sudo apt-add-repository universe
sudo apt-add-repository multiverse

Here you find some examples.

  • Yeah - I thought about mentioning that above, if you don't mind enabling unsupported, often closed source, software installs permanently... – MJHd Nov 1 '18 at 20:35
  • Or just enable -> then immediately disable if you want to use them for this purpose only – MJHd Nov 1 '18 at 20:36
  • 1
    You only need to enable the universe repository (user contributed software) to install the libzip package needed by php. No need to enable restricted or multiverse. – webmaster777 Jan 29 at 13:07
1

@ravery's answer got me half way there:

The problem though wasn't a conflict so much but simply that the 32 bit package won't satisfy the dependency requirement for 64 bit installation (even though you can install 32 versions of software in general with 32 bit dependencies) at least in this case (or in general - I have no idea).

Unfortunately, the 64 bit version either doesn't have an installation candidate, or has some other package name I don't know and can't find online.

sudo apt-get install libzip4  

Reading package lists... Done Building dependency tree
Reading state information... Done Package libzip4 is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package 'libzip4' has no installation candidate


I can't seem to find a ppa for the 64 bit package either...

If you follow @ravery advice and do:

sudo apt-get purge libzip4

You get:

Reading package lists... Done Building dependency tree
Reading state information... Done The following packages will be REMOVED: libzip4:i386* 0 upgraded, 0 newly installed, 1 to remove and 20 not upgraded. After this operation, 121 kB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 311771 files and directories currently installed.) Removing libzip4:i386 (1.0.1-0ubuntu1) ... Purging configuration files for libzip4:i386 (1.0.1-0ubuntu1) ... Processing triggers for libc-bin (2.23-0ubuntu9) ...

So the 32 bit version is now removed

Then:

Go to pkgs.org: https://ubuntu.pkgs.org/16.04/ubuntu-universe-amd64/libzip4_1.0.1-0ubuntu1_amd64.deb.html

Here you can download and manually install the 64 bit .deb package that apt-get either doesn't have or can't locate by name...

Finally Just run:

sudo apt-get install php-zip

The dependency issue is resolved and the plugin installs normally!

  • 1
    open your software center, click on repositories, and enable the universe and restricted repositories... you apparently only have main enabled. if you notice the url where you downloaded.. it is ubuntu universe – ravery Jul 7 '17 at 23:51
  • Is that perfectly safe? (Stability/security) – MJHd Jul 7 '17 at 23:52
  • yes, universe is contributers, restricted is software that has use licenses, like drivers. they are both safe, just not fully conforming to "FREE use" licensing thus are held separate from main – ravery Jul 7 '17 at 23:54
  • Awesome - just did it - thanks for recommendation. I would much prefer NOT to have to do this manually next time... – MJHd Jul 8 '17 at 0:26

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.