Can't install laravel installer via composer

158,195

Solution 1

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

Solution 2

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

Solution 3

On centos 7 I have used:

yum install php-pecl-zip

because any other solution didn't work for me.

Solution 4

For PHP7.1 install this

sudo apt-get install php7.1-zip

Solution 5

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

Share:
158,195
Andreas Sauer
Author by

Andreas Sauer

Updated on August 04, 2020

Comments

  • Andreas Sauer
    Andreas Sauer almost 4 years

    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"
    
  • Tyler Christian
    Tyler Christian about 6 years
    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.
  • Alex
    Alex about 6 years
    @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.
  • Henry
    Henry almost 6 years
    requires ext-zip is a pretty unhelpful message. Should say requires php-zip or phpX.X-zip at least.
  • Eric Hauenstein
    Eric Hauenstein almost 5 years
    Please add some comments to explain how your code answers the question in order to improve this answer.
  • mehmetakkus
    mehmetakkus almost 5 years
    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'
  • user1771561
    user1771561 over 4 years
    Before step 4, open a new terminal window, else the new $PATH will not be available.
  • Martijn Pieters
    Martijn Pieters about 4 years
    The question asks about Ubuntu, not CentOS.
  • Martijn Pieters
    Martijn Pieters about 4 years
    The question asks about Ubuntu, not CentOS.
  • Martijn Pieters
    Martijn Pieters about 4 years
    The question asks about Ubuntu, not Mac.
  • Martijn Pieters
    Martijn Pieters about 4 years
    The question asks about Ubuntu, not Mac.
  • Martijn Pieters
    Martijn Pieters about 4 years
    The question asks about Ubuntu, not Mac.
  • Hosny Ben
    Hosny Ben about 4 years
    for mac os users please user Homebrew instead. You don't need to run brew commands as root. example : brew install php7.0-zip
  • GTS Joe
    GTS Joe about 4 years
    This is exactly what I was looking for, thanks. yum install php-zip doesn't work on CentOS 7.
  • Nico Haase
    Nico Haase almost 4 years
    Please add some further explanation to your answer - how does this list of commands resolve the given problem?
  • Nico Haase
    Nico Haase almost 4 years
    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?
  • Jaydip Kalkani
    Jaydip Kalkani almost 4 years
    addition, brew link [email protected] didn't work. It gave me a warning. I needed to force it using brew link [email protected] --force.
  • danielricecodes
    danielricecodes almost 4 years
    But I got here looking for this error and I'm on OS X Catalina. This answer is helpful.
  • Art Williams
    Art Williams over 3 years
    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