How to Fix: Can't install package via composer: PHP extension zip is missing
Missing PHP zip extension prevents Laravel installation via Composer.
📋 Table of Contents
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
- 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)
- 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
- Step 1: Open your terminal and type `sudo apt-get install php7.4-zip` to install the Zip extension.
Method 4: Updating Composer
- 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.
❓ Frequently Asked Questions
🛠️ Related Fixes
How to Fix: Pc crashes shortly after launching game (rainbow
Pc crashes shortly after launching game, possible cause: outdated grap
How to Fix: Installing an APK on a locked down phone
Installing an APK on a locked down phone: Try using a rooted device, e
How to Fix: FPS drops
FPS drops in games can be caused by high system resource usage, outdat