142

I'm trying to install laravel installer with the composer on my Ubuntu PC, but I get this error during the installation. `Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/installer v1.4.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - laravel/installer v1.4.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - Installation request for laravel/installer ^1.4 -> satisfiable by laravel/installer[v1.4.0, v1.4.1].

  To enable extensions, verify that they are enabled in those .ini files:
    - /etc/php/7.0/cli/php.ini
    - /etc/php/7.0/cli/conf.d/10-opcache.ini
    - /etc/php/7.0/cli/conf.d/10-pdo.ini
    - /etc/php/7.0/cli/conf.d/20-calendar.ini
    - /etc/php/7.0/cli/conf.d/20-ctype.ini
    - /etc/php/7.0/cli/conf.d/20-exif.ini
    - /etc/php/7.0/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.0/cli/conf.d/20-ftp.ini
    - /etc/php/7.0/cli/conf.d/20-gettext.ini
    - /etc/php/7.0/cli/conf.d/20-iconv.ini
    - /etc/php/7.0/cli/conf.d/20-json.ini
    - /etc/php/7.0/cli/conf.d/20-phar.ini
    - /etc/php/7.0/cli/conf.d/20-posix.ini
    - /etc/php/7.0/cli/conf.d/20-readline.ini
    - /etc/php/7.0/cli/conf.d/20-shmop.ini
    - /etc/php/7.0/cli/conf.d/20-sockets.ini
    - /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.0/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.0/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.0/cli/conf.d/20-tokenizer.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
`

The error appears then I use this comment:

composer global require "laravel/installer"
0

14 Answers 14

329

It says that it requires zip extension

laravel/installer v1.4.0 requires ext-zip...

Install using (to install the default version):

sudo apt install php-zip

Or, if you're running a specific version of PHP:

# For php v7.0
sudo apt-get install php7.0-zip

# For php v7.1
sudo apt-get install php7.1-zip

# For php v7.2
sudo apt-get install php7.2-zip

# For php v7.3
sudo apt-get install php7.3-zip

# For php v7.4
sudo apt-get install php7.4-zip
4
  • 1
    Works perfectly but shouldn't this be in the composer install? It's a dependency manager...missing a dependency. Maybe it was Cannonical that missed the inclusion. Commented May 23, 2018 at 5:52
  • 2
    @TylerChristian, composer install manages PHP dependencies, php7.0-zip is a system package. It can't be solved by composer. Theoretically, it's possible to add hook that installs system package as well, but it will require sudo access, which is REALLY bad practice.
    – Alex
    Commented May 23, 2018 at 8:06
  • 4
    requires ext-zip is a pretty unhelpful message. Should say requires php-zip or phpX.X-zip at least.
    – Henry
    Commented Jul 10, 2018 at 21:18
  • 2
    for mac os users please user Homebrew instead. You don't need to run brew commands as root. example : brew install php7.0-zip
    – Hosny Ben
    Commented May 24, 2020 at 1:55
55

FOR MAC USERS with CATALINA

First, install homebrew. Then, say

brew install [email protected]
brew link [email protected]

restart the console and run the laravel installer

3
  • The question asks about Ubuntu, not Mac. Commented Apr 10, 2020 at 8:10
  • Please add some further explanation to your answer - how does this command resolve the given problem? Is there any problem in simply installing the given extension without installing other programs first?
    – Nico Haase
    Commented Jul 29, 2020 at 12:17
  • addition, brew link [email protected] didn't work. It gave me a warning. I needed to force it using brew link [email protected] --force. Commented Aug 29, 2020 at 3:41
23

On centos 7 I have used:

yum install php-pecl-zip

because any other solution didn't work for me.

3
  • The question asks about Ubuntu, not CentOS. Commented Apr 10, 2020 at 8:07
  • This is exactly what I was looking for, thanks. yum install php-zip doesn't work on CentOS 7.
    – GTS Joe
    Commented Jun 12, 2020 at 23:01
  • 1
    for specific versions of php use one of the following package names after "yum install": php54-php-pecl-zip php55-php-pecl-zip php56-php-pecl-zip php70-php-pecl-zip php71-php-pecl-zip php72-php-pecl-zip php73-php-pecl-zip php74-php-pecl-zip php80-php-pecl-zip Commented Feb 19, 2021 at 17:29
19

For PHP7.1 install this

sudo apt-get install php7.1-zip
7

If you're facing this issue with macOS Catalina, I recommend these steps:

  1. Install Homebrew (if you haven't already done so): head over to brew.sh or simply run this command: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

  2. Run brew install [email protected]

  3. Update your $PATH variable to include the newly installed version of php:

echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc

echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.zshrc

  1. Reload your shell preferences script $ source ~/.zshrc or source ~/.bashrc

  2. Finally, install laravel: composer global require laravel/installer

3
  • 1
    Before step 4, open a new terminal window, else the new $PATH will not be available. Commented Feb 11, 2020 at 14:33
  • The question asks about Ubuntu, not Mac. Commented Apr 10, 2020 at 8:10
  • But I got here looking for this error and I'm on OS X Catalina. This answer is helpful. Commented Sep 14, 2020 at 23:47
5

For Ubuntu 16.04, I have used this command for PHP7.2 and it worked for me.

sudo apt-get install php7.2-zip
5

Centos 7 with PHP7.2:

sudo yum --enablerepo=remi-php72 install php-pecl-zip
1
  • The question asks about Ubuntu, not CentOS. Commented Apr 10, 2020 at 8:07
3

to know your php version

php -v 

for php 7.3.0

sudo apt-get install php7.3-zip
1
  • I'm getting this error E: Unable to locate package php7.3-zip E: Couldn't find any package by glob 'php7.3-zip' E: Couldn't find any package by regex 'php7.3-zip' Commented Jul 14, 2019 at 20:12
3
V=`php -v | sed -e '/^PHP/!d' -e 's/.* \([0-9]\+\.[0-9]\+\).*$/\1/'` \
sudo apt-get install php$V-zip
1
  • 1
    Please add some comments to explain how your code answers the question in order to improve this answer. Commented Jul 3, 2019 at 12:48
2

For Mac with Macports,

# port install php71-zip
1
  • The question asks about Ubuntu, not Mac. Commented Apr 10, 2020 at 8:10
2

For PHP 7.2 in Ubuntu 18.04 LTS

sudo apt-get install php7.2-zip

Works like a charm

2

zip extension is missing, You can avoid this error by simple running below command, It will take version by default

sudo apt-get install php-zip

In case you need any specific version, You need to mention a specific version of your php, Suppose I need to install X version of php-zip then the command will be.

sudo apt-get install phpX-zip  

Replace X with your required version, In my case, it is X = 7.3

2

For macOs users you can use Homebrew instead :

# For php v7.0
brew install [email protected]

# For php v7.1
brew install [email protected]

# For php v7.2
brew install [email protected]

# For php v7.3
brew install [email protected]

# For php v7.4
brew install [email protected]
1
  • Please add some further explanation to your answer - how does this list of commands resolve the given problem?
    – Nico Haase
    Commented Jul 29, 2020 at 12:16
1

I am using WSL with ubuntu 16.04 LTS version with php 7.3 and laravel 5.7

sudo apt-get install php7.3-zip

Work for me

Not the answer you're looking for? Browse other questions tagged or ask your own question.