Composer require ext-zip fails

✔ Recommended Answer

Solution #1 - add ext-zip to your required section of composer.json:

{    "require" : {        "ext-zip": "*"    }}

Solution #2 - install php-zip extension:

Windows:

Uncomment this line in your php.ini

;extension=php_zip.dll

Linux:

sudo apt-get install php-zip

or

sudo apt-get install php7.0-zip (make sure you typed YOUR php version, you can check your version by doing php -v command)

Then, you need to restart your web server.

sudo service apache2 restart

If you are experiencing issues with Composer failing to install or update packages due to missing ext-zip extension, there are a few steps you can take to resolve this issue:

  1. Verify that ext-zip is not installed: You can verify if the extension is installed or not by running the following command in the terminal:

    python
    php -m | grep zip

    If the output does not include zip then the extension is not installed.

  2. Install ext-zip extension: You can install the extension using your system's package manager. For example, on Ubuntu, you can run the following command in the terminal to install the extension:

    python
    sudo apt-get install php-zip

    On other Linux distributions, the package name may be different, so please check the documentation for your system.

  3. Restart the web server: After installing the extension, you may need to restart the web server to ensure that it is loaded properly.

  4. Run composer update or composer install command again: Once the extension is installed and the web server is restarted, try running the composer update or composer install command again. It should now be able to install the required packages without any issues.

If the above steps do not resolve the issue, it may be helpful to review the error message that Composer is displaying to determine if there are any other dependencies or conflicts that need to be resolved.

Comments

Most Popular

Remove Unicode Zero Width Space PHP

PhpStorm, return value is expected to be 'A', 'object' returned

Laravel file upload returns forbidden 403, file permission is 700 not 755