Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

Composer cannot unpack packages because zip and unzip are missing

ErrorThe zip extension and unzip/7z commands are both missing, skipping.

Short answer

Composer unpacks downloaded packages with a system unzip or 7z tool, or with PHP's zip extension. The warning appears when neither is available to the PHP that runs Composer. Enable the zip extension in that PHP's php.ini, or install unzip, then run composer install again.

  • Applies to Composer 2, PHP 8.3, PHP 8.4, Windows 11, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Ask the exact PHP that runs Composer which ini file it loads and whether the zip extension is on. Composer may use a different PHP than the one you expect.

    php --ini
    php -m | grep -i zip
  2. 2Match what you see, then jump to its fix

    1. 1php -m prints nothing for zipThe zip extension is not enabled in the PHP that runs ComposerFix
    2. 2The extension is on, but archives still extract badly, or the warning remains when zip is offNo unzip or 7z command is installed on the systemFix

What does the error look like?

  • The zip extension and unzip/7z commands are both missing, skipping.

Cause 1 of 2

The zip extension is not enabled in the PHP that runs Composer

1Check

From PHP 8.2 on Windows, php_zip.dll is no longer built in and must be enabled in php.ini. Use the path shown by php --ini.

php --ini

2Fix

Open the loaded php.ini and enable the extension by uncommenting or adding this line.

; php.ini
extension=zip

3Verify

The module is listed, and Composer no longer shows the warning.

php -m | grep -i zip
composer install

Confirmed by php.net

Did this fix it?

Cause 2 of 2

No unzip or 7z command is installed on the system

1Check

Composer unpacks with a system unzip or 7z utility or with PHP's ZipArchive class. Composer's own guide recommends installing unzip or 7z because ZipArchive does not support every archive feature.

unzip -v
7z

2Fix

Install unzip, or 7-Zip, and make sure it is on the PATH of the shell that runs Composer.

sudo apt update && sudo apt install unzip

3Verify

The command exists, and the install finishes without the warning.

unzip -v
composer install

Confirmed by getcomposer.org

Did this fix it?

How do I stop it coming back?

  • Keep the zip extension on in the php.ini of every environment that runs Composer, including CI images.
  • Run php --ini before debugging, since several PHP builds can be installed on one machine.
  • Install unzip in your base Docker or server image once, so installs do not depend on ZipArchive.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

CodeIgniter 4 cannot write its cache files

CodeIgniter\Cache\Exceptions\CacheException: Cache unable to write to /var/www/app/writable/cache/

CodeIgniter 4's file cache needs a cache directory that the web server can really write to.

2 causes, each with a fix

Back end

CodeIgniter 3 loads the model but the property is undefined

The model name you are loading is the name of a resource that is already being used: user

CodeIgniter 3 expects a model file named like its class, with the first letter capitalised, for example User_model.php holding class User_model.

2 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.