尝试从作曲家安装laravel时缺少PHP扩展名zip

问题描述 投票:3回答:3

我在这里的其他帖子上看到了这个问题的答案,但是所有答案都对我无效。主要是因为我试图在Mac上本地安装laravel,答案是针对Linux环境的,而且brew声称它没有此扩展。这是我运行composer命令时的输出:

$ composer global require "laravel/installer"

Changed current directory to /Users/frankaddelia/.composer
Using version ^2.0 for laravel/installer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/installer v2.0.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - laravel/installer v2.0.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - Installation request for laravel/installer ^2.0 -> satisfiable by laravel/installer[v2.0.0, v2.0.1].

  To enable extensions, verify that they are enabled in your .ini files:
    - /usr/local/php5/lib/php.ini
    - /usr/local/php5/php.d/10-extension_dir.ini
    - /usr/local/php5/php.d/20-extension-opcache.ini
    - /usr/local/php5/php.d/40-curl.ini
    - /usr/local/php5/php.d/40-openssl.ini
    - /usr/local/php5/php.d/50-extension-apcu.ini
    - /usr/local/php5/php.d/50-extension-curl.ini
    - /usr/local/php5/php.d/50-extension-gmp.ini
    - /usr/local/php5/php.d/50-extension-igbinary.ini
    - /usr/local/php5/php.d/50-extension-imap.ini
    - /usr/local/php5/php.d/50-extension-intl.ini
    - /usr/local/php5/php.d/50-extension-mcrypt.ini
    - /usr/local/php5/php.d/50-extension-mongodb.ini
    - /usr/local/php5/php.d/50-extension-mssql.ini
    - /usr/local/php5/php.d/50-extension-pdo_pgsql.ini
    - /usr/local/php5/php.d/50-extension-pgsql.ini
    - /usr/local/php5/php.d/50-extension-propro.ini
    - /usr/local/php5/php.d/50-extension-raphf.ini
    - /usr/local/php5/php.d/50-extension-readline.ini
    - /usr/local/php5/php.d/50-extension-redis.ini
    - /usr/local/php5/php.d/50-extension-xsl.ini
    - /usr/local/php5/php.d/99-liip-developer.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Installation failed, reverting ./composer.json to its original content.

我尝试用brew安装缺少的扩展名,但出现如下错误:

$ brew install php7.2-zip
Updating Homebrew...
Error: No available formula with the name "php7.2-zip" 
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.

顺便说一下,这是我的PHP版本:

php -v
PHP 7.3.0beta2 (cli) (built: Aug 21 2018 08:13:27) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.0beta2, Copyright (c) 1999-2018, by Zend Technologies

我似乎无法弄清楚如何获得此缺少的扩展名,并且经过数小时的谷歌搜索后,仍未找到适合我的解决方案。我只是重新格式化了Mac,以处理另一个服务器环境问题,所以我不介意重新安装并重新开始,但是我想尝试解决此问题,如果可能的话,不要这样做。非常感谢您的帮助!

*编辑*php -m

的输出
$ php -m
[PHP Modules]
apcu
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
igbinary
imap
intl
json
libxml
mbstring
mcrypt
mongodb
mysqli
mysqlnd
odbc
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
propro
raphf
readline
redis
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zlib

[Zend Modules]
Zend OPcache
php laravel composer-php
3个回答
2
投票

在终端上运行:sudo apt-get install php7.2-zip && sudo apt-get install php-zip。之后,您将运行命令(sudo作曲家全局需要“ laravel / installer”)


0
投票

为什么作曲家错误显示您正在使用php5?

To enable extensions, verify that they are enabled in your .ini files:
    - /usr/local/php5/lib/php.ini
    - /usr/local/php5/php.d/10-extension_dir.ini
    - /usr/local/php5/php.d/20-extension-opcache.ini
    - /usr/local/php5/php.d/40-curl.ini
    - /usr/local/php5/php.d/40-openssl.ini
    - /usr/local/php5/php.d/50-extension-apcu.ini
    - /usr/local/php5/php.d/50-extension-curl.ini
    - /usr/local/php5/php.d/50-extension-gmp.ini
    - /usr/local/php5/php.d/50-extension-igbinary.ini
    - /usr/local/php5/php.d/50-extension-imap.ini
    - /usr/local/php5/php.d/50-extension-intl.ini
    - /usr/local/php5/php.d/50-extension-mcrypt.ini
    - /usr/local/php5/php.d/50-extension-mongodb.ini
    - /usr/local/php5/php.d/50-extension-mssql.ini
    - /usr/local/php5/php.d/50-extension-pdo_pgsql.ini
    - /usr/local/php5/php.d/50-extension-pgsql.ini
    - /usr/local/php5/php.d/50-extension-propro.ini
    - /usr/local/php5/php.d/50-extension-raphf.ini
    - /usr/local/php5/php.d/50-extension-readline.ini
    - /usr/local/php5/php.d/50-extension-redis.ini
    - /usr/local/php5/php.d/50-extension-xsl.ini
    - /usr/local/php5/php.d/99-liip-developer.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

您之前使用过php5吗?如果是,我想您可以先尝试卸载php5


0
投票

首先,您必须安装php扩展zip。要安装,只需运行以下

    sudo apt-get install php7.2-zip && sudo apt-get install php-zip

现在您可以尝试再次使用composer安装laravel安装程序

© www.soinside.com 2019 - 2024. All rights reserved.