php 无法通过composer安装laravel安装程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46058457/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 03:10:53  来源:igfitidea点击:

Can't install laravel installer via composer

phplaravelubuntularavel-5

提问by Andreas Sauer

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.

我正在尝试在我的 Ubuntu PC 上使用 composer 安装 laravel 安装程序,但在安装过程中出现此错误。`您的要求无法解析为一组可安装的软件包。

  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"

回答by Alex

It says that it requires zip extension

它说它需要zip 扩展

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

laravel/installer v1.4.0 需要 ext-zip ......

Install the version respective to installed php version :

安装对应于已安装 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

回答by Evan

On centos 7 I have used:

在centos 7上我使用过:

yum install php-pecl-zip

because any other solution didn't work for me.

因为任何其他解决方案对我都不起作用。

回答by Muhammad F. Musad

For PHP7.1 install this

对于 PHP7.1 安装这个

sudo apt-get install php7.1-zip

回答by Miko?aj Marciniak

FOR MAC USERS with CATALINA

对于使用 CATALINA 的 MAC 用户

First, install homebrew. Then, say

首先,安装自制软件。然后说

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

restart the console and run the laravel installer

重新启动控制台并运行 Laravel 安装程序

回答by Marcos Curvello

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

如果您在使用macOS Catalina 时遇到此问题,我建议您执行以下步骤:

  1. Install Homebrew (if you haven't already done so): head over to brew.shor 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:

  1. 安装 Homebrew(如果您还没有这样做):转到brew.sh或简单地运行以下命令:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

  2. brew install [email protected]

  3. 更新您的 $PATH 变量以包含新安装的 php 版本:

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

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

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

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

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

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

  1. 重新加载您的 shell 首选项脚本$ source ~/.zshrcsource ~/.bashrc

  2. 最后,安装laravel: composer global require laravel/installer

回答by Amit Khanna

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

对于Ubuntu 16.04,我已经使用了这个命令PHP7.2并且它对我有用。

sudo apt-get install php7.2-zip

回答by Amirul

Centos 7 with PHP7.2:

Centos 7 与 PHP7.2:

sudo yum --enablerepo=remi-php72 install php-pecl-zip

回答by borodatych

V=`php -v | sed -e '/^PHP/!d' -e 's/.* \([0-9]\+\.[0-9]\+\).*$//'` \
sudo apt-get install php$V-zip

回答by Ian Samz

For PHP 7.2 in Ubuntu 18.04 LTS

对于 Ubuntu 18.04 LTS 中的 PHP 7.2

sudo apt-get install php7.2-zip

Works like a charm

奇迹般有效

回答by mohamed elshazly

to know your php version

知道你的php版本

php -v 

for php 7.3.0

对于 php 7.3.0

sudo apt-get install php7.3-zip