Common causes
- The zip extension is not ticked in the host's PHP extension selector (cPanel Select PHP Version, Hostinger PHP Extensions)
- The php-zip package was never installed for the PHP version in use (for example php8.3-zip on Ubuntu)
- The extension is enabled for the CLI but not for PHP-FPM/Apache, or vice versa (different php.ini files)
- The site was switched to a new PHP version and its extension list was not copied over
- In Docker images based on php:*, the extension must be compiled with docker-php-ext-install zip
- On Windows/XAMPP, extension=zip is commented out in php.ini
How to fix it
- Confirm which PHP is running. Create a temporary file with <?php phpinfo(); or run php -m | grep zip on the CLI. Note the PHP version and the 'Loaded Configuration File' path, then delete the phpinfo file.
- Enable it in your hosting panel. In cPanel open Select PHP Version (CloudLinux) > Extensions and tick zip; on Hostinger use Advanced > PHP Configuration > PHP Extensions. On cPanel EasyApache hosts the package is called ea-phpXX-php-zip and the host enables it.
- Install it on a VPS. On Debian/Ubuntu install the package matching your version, e.g. sudo apt install php8.3-zip, then restart PHP-FPM (sudo systemctl restart php8.3-fpm) or Apache.
- Enable it on Windows/XAMPP. Open php.ini, remove the semicolon from ;extension=zip, save and restart Apache from the XAMPP control panel.
- Add it to your Docker image. In a php:8.x Dockerfile install libzip-dev and run docker-php-ext-install zip, then rebuild the image.
- Verify for both CLI and web. Check php -r 'var_dump(class_exists("ZipArchive"));' and the web phpinfo output; cron jobs and queue workers use the CLI binary, which can have a different configuration.
Dockerfile (php:8.3-apache)
FROM php:8.3-apache
RUN apt-get update \
&& apt-get install -y --no-install-recommends libzip-dev \
&& docker-php-ext-install zip \
&& rm -rf /var/lib/apt/lists/* How to stop it happening again
- Declare "ext-zip": "*" in composer.json require so Composer flags the missing extension at install time
- Re-check enabled extensions every time you change the site's PHP version
- Keep the CLI and web PHP versions identical on the server