-1

I am using php 7.4 and laravel for our project. We are working on it as a group of two. So whenever my co-worker adds a package, i have to run composer install to install the package. But now when i try to run composer install, i get the following error:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for spatie/laravel-backup 6.15.0 -> satisfiable by spatie/laravel-backup[6.15.0].
    - spatie/laravel-backup 6.15.0 requires ext-zip ^1.14.0 -> the requested PHP extension zip is missing from your system.

  To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/7.4/cli/php.ini
    - /etc/php/7.4/cli/conf.d/10-mysqlnd.ini
    - /etc/php/7.4/cli/conf.d/10-opcache.ini
    - /etc/php/7.4/cli/conf.d/10-pdo.ini
    - /etc/php/7.4/cli/conf.d/15-xml.ini
    - /etc/php/7.4/cli/conf.d/20-bcmath.ini
    - /etc/php/7.4/cli/conf.d/20-calendar.ini
    - /etc/php/7.4/cli/conf.d/20-ctype.ini
    - /etc/php/7.4/cli/conf.d/20-curl.ini
    - /etc/php/7.4/cli/conf.d/20-dom.ini
    - /etc/php/7.4/cli/conf.d/20-exif.ini
    - /etc/php/7.4/cli/conf.d/20-ffi.ini
    - /etc/php/7.4/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.4/cli/conf.d/20-ftp.ini
    - /etc/php/7.4/cli/conf.d/20-gd.ini
    - /etc/php/7.4/cli/conf.d/20-gettext.ini
    - /etc/php/7.4/cli/conf.d/20-gmp.ini
    - /etc/php/7.4/cli/conf.d/20-iconv.ini
    - /etc/php/7.4/cli/conf.d/20-json.ini
    - /etc/php/7.4/cli/conf.d/20-mbstring.ini
    - /etc/php/7.4/cli/conf.d/20-mysqli.ini
    - /etc/php/7.4/cli/conf.d/20-pdo_mysql.ini
    - /etc/php/7.4/cli/conf.d/20-phar.ini
    - /etc/php/7.4/cli/conf.d/20-posix.ini
    - /etc/php/7.4/cli/conf.d/20-readline.ini
    - /etc/php/7.4/cli/conf.d/20-shmop.ini
    - /etc/php/7.4/cli/conf.d/20-simplexml.ini
    - /etc/php/7.4/cli/conf.d/20-sockets.ini
    - /etc/php/7.4/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.4/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.4/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.4/cli/conf.d/20-tokenizer.ini
    - /etc/php/7.4/cli/conf.d/20-xmlreader.ini
    - /etc/php/7.4/cli/conf.d/20-xmlwriter.ini
    - /etc/php/7.4/cli/conf.d/20-xsl.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

How should i fix this?

Ardalan
  • 723
  • 9
  • 26

2 Answers2

0

There is an extension missing that is required. Install it via:

sudo apt-get install php7.4-zip

Daniel Juric
  • 128
  • 1
  • 10
-1

Use --ignore-platform-reqs option for composer commands like install, update etc to ignore platform requirements.

--ignore-platform-reqs: ignore php, hhvm, lib-* and ext-* requirements and force the installation even if the local machine does not fulfill these. See also the platform config option.

https://getcomposer.org/doc/03-cli.md

So you can try with

composer install --ignore-platform-reqs

Original answer : Override PHP base dependency in composer

Youssef
  • 474
  • 3
  • 11
  • This might be useful but comes with a negative point: If you are running an old version of php and force ignoring it, you might see some errors because of the wrong version – Daniel Juric Mar 15 '21 at 10:35
  • 1
    Yes I know but he didn't specify system that he is using so that I can give him complete answer, for example your answer will not work if he is using `CentOS` – Youssef Mar 15 '21 at 10:59
  • Usually, this is not a good idea. If the application requires `ext-zip`, that should be installed – Nico Haase Mar 15 '21 at 11:04