100

I am getting this error, when trying to install Zip for PHP 7:

pecl install zip

yields the error

configure: error: Please reinstall the libzip distribution

I did not find anything related to this error.

I tried apt-get install libzip but the package was not found.

halfer
  • 19,824
  • 17
  • 99
  • 186
Tobias Gassmann
  • 11,399
  • 15
  • 58
  • 92

5 Answers5

266

Solved it:

apt-get install libzip-dev

will install the missing libzip-distribution

Tobias Gassmann
  • 11,399
  • 15
  • 58
  • 92
  • 3
    Note you can do `apt-cache search libzip` or `apt-cache search zip` to do a search for potential installation names. Pipe it through `less` if it comes back with a lot of results, so you can scroll through slowly. – halfer Aug 19 '17 at 20:52
  • 3
    For CentOS users: `yum -y install libzip-devel` – Til Apr 27 '19 at 15:55
  • 5
    This gives me `E: Unable to locate package libzip-dev` also – David Apr 30 '19 at 14:23
11

This might be helpful for webmin/virtualmin users running CentOS 7:

 yum install php-pecl-zip

This worked for me.

Doomd
  • 1,271
  • 1
  • 16
  • 27
  • 1
    Thanks, tried everything and nothing would install / enable zip for me. – Matt Nona Jun 21 '20 at 11:33
  • 1
    Life saver! Been trying to solve this for a week... – Woody Sep 06 '20 at 02:37
  • Didn't work: ~~~ [root@host ~]# yum install php-pecl-zip Loaded plugins: fastestmirror, universal-hooks Loading mirror speeds from cached hostfile * EA4: 185.125.185.32 * cpanel-addons-production-feed: 185.125.185.32 * cpanel-plugins: 185.125.185.32 * base: mirrors.rit.edu * extras: forksystems.mm.fcix.net * updates: mirror.cs.pitt.edu No package php-pecl-zip available. Error: Nothing to do ~~~ – Ignat Feb 26 '23 at 16:31
5

This worked for me with Amazon Linux:

yum install libzip-devel.x86_64
Bill Ravdin
  • 249
  • 2
  • 6
3

At the time of this writing, I had to use libzip > = 0.11. The libzip/libzip-devel package on the official CentOS x86_64 repository is still on 0.10. To get around this, the Psychotic Ninja Plus x86_64 repository offers a 0.11 version. Information for libzip and libzip-devel on the Psychotic Ninja Plus repositories can be found on those links.

To install and use this version, you can run the following commands,

Download latest psychotic-release rpm from http://packages.psychotic.ninja/7/plus/x86_64/RPMS/

Install psychotic-release rpm:

rpm -Uvh psychotic-release*rpm

Install libzip-devel rpm package:

yum --enablerepo=psychotic-plus install libzip-devel
Tom
  • 1,223
  • 1
  • 16
  • 27
  • 1
    This worked for me on CentOS. Had to download and install both libzip-0.11.2-6.el7.psychotic.x86_64.rpm and libzip-devel-0.11.2-6.el7.psychotic.x86_64.rpm – MarkG Apr 01 '20 at 07:30
  • I already had 0.10 installed, I had to remove it before configure would recognize the new files: sudo yum remove libzip; sudo yum localinstall /var/tmp/libzip-0.11.2-6.el7.psychotic.x86_64.rpm; sudo yum localinstall /var/tmp/libzip-devel-0.11.2-6.el7.psychotic.x86_64.rpm; sudo yum install php-common – ChrisG Oct 14 '22 at 11:28
2

Since it took me some time and research to figure this out i think it may come handy for mac-users:

You can install libzip through brew using:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null

And then:

brew install libzip
pr1nc3
  • 8,108
  • 3
  • 23
  • 36