Home > database >  Composer won't install package, requires ext-zip
Composer won't install package, requires ext-zip

Time:04-18

Server runs PHP 8. This is the error message returned when attempting to deploy.

Your lock file does not contain a compatible set of packages. Please run composer update. Problem 1 - phpoffice/phpspreadsheet is locked to version 1.22.0 and an update of this package was not requested. - phpoffice/phpspreadsheet 1.22.0 requires ext-zip * -> it is missing from your system. Install or enable PHP's zip extension.

Here is the script section of my gitlab-ci.yml file, which is used to build the application.

   script:
    - apt-get update -yqq
    - apt-get install git nodejs libcurl4-gnutls-dev libicu-dev libmcrypt-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libpq-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev -yqq zip unzip
    - docker-php-ext-install pdo_mysql curl intl gd xml bz2 opcache bcmath
    - pecl install xdebug
    - docker-php-ext-enable xdebug
    - curl -sS https://getcomposer.org/installer | php
    - php composer.phar install
    - npm install
    - php artisan config:cache

How do i install PHP zip extension for PHP 8? i've tried:

apt get install zip, pecl install php-pecl-zip, apt get install libzip-dev, docker-php-ext-install zip, apt get install php-zip

None of these have worked. On local the above script section works with PHP 8 but doesn't work on AWS Ubuntu with PHP 8? How do i solve?

CodePudding user response:

Try installing it with this command:

sudo apt-get install php8.0-zip

also you should probably restart your nginx/apache server as well as php-fpm

CodePudding user response:

You can install zip with following commands.

apt-get install -y libzip-dev zip  && docker-php-ext-install zip
  • Related