Software⏱️ 2 min read📅 2026-05-31

How to Fix: Can't install package via composer: PHP extension zip is missing

Missing PHP zip extension prevents Laravel installation via Composer.

Quick Answer: Enable the zip PHP extension by running `sudo apt-get install php-zip` on your Ubuntu system.

The error 'Can't install package via composer: PHP extension zip is missing' occurs when the PHP installation on your Ubuntu PC does not have the Zip extension enabled. This issue can be resolved by enabling the Zip extension in PHP and updating Composer.

🛑 Root Causes of the Error

  • The Zip extension is not enabled in PHP, causing Composer to fail during installation.

✅ Best Solutions to Fix It

Method 1: Enabling Zip Extension in PHP

  1. Step 1: Open your terminal and type `sudo apt-get update` to update the package list.

Method 2: Enabling Zip Extension in PHP (Using .conf File)

  1. Step 1: Open your terminal and type `sudo nano /etc/php/7.x/apache2/conf.d/10-fileinfo.conf` to edit the file.

Method 3: Installing Zip Extension using apt-get

  1. Step 1: Open your terminal and type `sudo apt-get install php7.4-zip` to install the Zip extension.

Method 4: Updating Composer

  1. Step 1: Open your terminal and type `composer self-update` to update Composer.

✨ Wrapping Up

Once you have enabled the Zip extension or updated Composer, try running `composer install` again to resolve the issue.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions