PHP 8.3.4 Released!

Installation

Linux systems

As of PHP 7.4.0, in order to use these functions you must compile PHP with zip support by using the --with-zip configure option. Previously, zip support had to be enabled by using the --enable-zip configure option. As of PHP 7.4.0, the bundled libzip is removed.

As of PHP 7.3.0, building against the bundled libzip is discouraged, but still possible by adding --without-libzip to the configuration.

A --with-libzip=DIR configure option has been added to use a system libzip installation. libzip version 0.11 is required, with 0.11.2 or later recommended.

Windows

As of PHP 8.2.0, php_zip.dll DLL must be enabled in php.ini. Previously, this extension was built-in.

Installation via PECL

Information for installing this PECL extension may be found in the manual chapter titled Installation of PECL extensions. Additional information such as new releases, downloads, source files, maintainer information, and a CHANGELOG, can be located here: » https://pecl.php.net/package/zip.

add a note

User Contributed Notes 7 notes

up
11
Marcel
5 years ago
Getting error

configure: error: Please reinstall the libzip distribution

when compiling this extension for php 7.3?

You need to install the 'libzip' package.

In Dockerfile you would do this like:

# Install zip
RUN apt-get update && \
apt-get install -y \
libzip-dev \
&& docker-php-ext-install zip
up
1
askertv at gmail dot com
1 month ago
No package 'libzip' found

INSTALLATION PHP FROM SOURCE:

./configure \
--prefix=/usr/local/php-7.4.5 \
--disable-debug \
--enable-fpm \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-inline-optimization \
--enable-ftp \
--enable-xml \
--with-libdir=/usr/lib64 \
--with-curl \
--with-iconv \
--with-gettext \
--with-mysqli \
--enable-pdo \
--with-pdo-mysql \
--with-zlib \
--with-zlib-dir=/usr/lib \
--srcdir=/usr/local/src/php-7.4.5 \
--enable-sockets \
--enable-soap \
--with-openssl \
--enable-gd \
--with-jpeg \
--with-xpm \
--with-freetype \
--with-zip \
--with-libzip=/usr/local/lib64/ \
ONIG_LIBS=/usr/lib64

checking for zip archive read/write support... yes
checking for libzip >= 0.11... no
configure: error: Package requirements (libzip >= 0.11) were not met:

No package 'libzip' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBZIP_CFLAGS
and LIBZIP_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

INSTALLATION libzip-1.10.1 from source:

make install
[ 50%] Built target zip
[ 94%] Built target man
[ 96%] Built target zipcmp
[ 96%] Built target zipmerge
[ 98%] Built target ziptool
[ 98%] Built target add-compressed-data
[ 98%] Built target autoclose-archive
[100%] Built target in-memory
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib64/pkgconfig/libzip.pc
-- Installing: /usr/local/lib64/cmake/libzip/modules/FindNettle.cmake
-- Installing: /usr/local/lib64/cmake/libzip/modules/Findzstd.cmake
-- Installing: /usr/local/lib64/cmake/libzip/modules/FindMbedTLS.cmake
-- Installing: /usr/local/include/zipconf.h
-- Installing: /usr/local/lib64/cmake/libzip/libzip-config.cmake
-- Installing: /usr/local/lib64/cmake/libzip/libzip-config-version.cmake
-- Installing: /usr/local/lib64/cmake/libzip/libzip-targets.cmake
-- Installing: /usr/local/lib64/cmake/libzip/libzip-targets-noconfig.cmake
-- Installing: /usr/local/lib64/libzip.so.5.5
-- Up-to-date: /usr/local/lib64/libzip.so.5
-- Up-to-date: /usr/local/lib64/libzip.so
-- Installing: /usr/local/include/zip.h
-- Installing: /usr/local/share/man/man3/ZIP_SOURCE_GET_ARGS.3
...
...
-- Installing: /usr/local/bin/zipcmp
-- Set runtime path of "/usr/local/bin/zipcmp" to ""
-- Installing: /usr/local/bin/zipmerge
-- Set runtime path of "/usr/local/bin/zipmerge" to ""
-- Installing: /usr/local/bin/ziptool
-- Set runtime path of "/usr/local/bin/ziptool" to ""

OS: RedHat-7.9
up
-1
askertv at gmail dot com
1 month ago
SOLVET "No package 'libzip' found":

$ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib64/pkgconfig/

$ ./configure \
...
--with-zip \
...

Configuration OK

$ make && make install
up
-7
php dot net at cage dot is
3 years ago
For those of you asking about how to update this within your Dockerfile, the answer seems to be to add to the environment variable like so:

ENV PHP_EXTRA_CONFIGURE_ARGS="--with-apxs2 --disable-cgi --with-zip"
up
-8
sgalyen at notspamarizona dot edu
3 years ago
In trying to compile PHP 7.4.x on CentOS 7.x I'm running into the dreaded "Package requirements (libzip >= 0.11) were not met"

As the referenced RPM package for lipzip 0.11.2 is a 3rd party (repo named Psychotic Ninja Plus, doesn't exactly inspire faith) I tried to compile from source.

I was able to find the git sha1 for 0.11.1 and compile successfully - if anyone needs it:
d2aac947ccc85bd4abbd02a6d9b237bdaa89d3f0

If someone in the know could post the sha1 for 0.11.2, or whatever preferred version of libzip that successfully compiles, I would appreciate it!
up
-15
mattcasiro at gmail dot com
5 years ago
If installing this in a Docker image using:
"docker-php-ext-install zip"

you may get an error such as:
"docker-php-ext-install zip returned a non-zero code: 1"
or
"zip support requires ZLIB"

Docker documentation now suggests this as the proper way to install, to ensure the dependant libraries are installed with it:
# Install zip
RUN apt-get update && \
apt-get install -y \
zlib1g-dev \
&& docker-php-ext-install zip
up
-25
Anonymous
3 years ago
This is how I installed it on my machine (ubuntu):
php 7:

sudo apt-get install php7.0-zip

service apache2 restart
To Top