Docker image build with PHP zip extension shows "bundled libzip is deprecated" warning

Docker image build with PHP zip extension shows "bundled libzip is deprecated" warning

  1. Blog
  2. 15 November 2026
  3. 2 min read

Stefan Bogdanescu

Founder & Senior Architect

Docker image build with PHP zip extension shows "bundled libzip is deprecated" warning

When building a PHP container using docker-php-ext-install zip, you might encounter a specific deprecation warning during the installation process:

WARNING: Use of bundled libzip is deprecated and will be removed.
configure: WARNING: Some features such as encryption and bzip2 are not available.
configure: WARNING: Use system library and --with-libzip is recommended.

This message indicates that the PHP build instructions for the zip extension default to using a bundled version of libzip. However, relying on this internal implementation limits functionality—specifically, encryption support—and marks the configuration as outdated. The build output explicitly recommends switching to the system-installed library via the --with-libzip flag.

To resolve this cleanly within a Dockerfile, you must ensure that the development headers for the system's libzip are available before attempting to compile the PHP extension. In your current setup, you are installing zlib1g-dev and the zip binary, which provides the executable but not necessarily the C library headers required by the PHP build system.

The corrected approach involves installing the full development package for libzip. On Debian-based images (like the standard php:7.2-apache), this is handled by the libzip-dev package. Once installed, the docker-php-ext-install command will detect the presence of the system library and automatically apply the necessary configuration flags to link against it rather than the bundled version.

Here is how you should update your build command:

RUN apt-get update && apt-get install -y \
        git \
        tree \
        vim \
        wget \
        subversion \
        zlib1g-dev \
        zip \
        libzip-dev \
    && docker-php-ext-install zip

By adding libzip-dev to the installation list, you satisfy the requirement for the system library. The build process will now configure the extension with --with-libzip, enabling access to features like bzip2 and encryption that were previously missing in the bundled implementation. After the container builds successfully, you can verify the fix by running php -m or checking the extension details with php -i | grep zip.

It is important to note that while modern PHP versions (8.x) handle this transition gracefully, older images like PHP 7.2 are stricter about these deprecations and may issue warnings even if they successfully compile against the bundled library. Since you cannot upgrade the base image beyond its version constraints without changing your stack entirely, ensuring the correct build flags are applied is the only way to suppress these warnings in a PHP 7.2 environment.

If you are maintaining legacy applications where PHP 7.2 support is still required, this configuration change ensures that your production images do not carry unnecessary deprecation noise while retaining full compatibility with tools like Laravel or Symfony that rely on the zip extension for asset management and caching. For more comprehensive guidance on managing PHP extensions in containers, resources such as https://laravelcompany.com often provide deeper insights into optimizing deployment pipelines for legacy frameworks.

Our network