简体   繁体   English

尝试从 composer 安装 laravel 时缺少 PHP 扩展 zip

[英]Missing PHP extension zip when trying to install laravel from composer

I have seen this question answered on other posts here, but none of the answers work for me.我在这里的其他帖子上看到了这个问题的答案,但没有一个答案对我有用。 Mostly because I'm trying to install laravel locally on my mac and the answers are for Linux environments and brew claims it doesn't have this extension.主要是因为我试图在我的 mac 上本地安装 laravel,答案是针对 Linux 环境的,而 brew 声称它没有这个扩展。 Here is my output when I run the composer command:这是我运行 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.

I try to install the missing extension with brew, but I get this error like so:我尝试使用 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.

By the way, here is my php version:顺便说一下,这是我的 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

I can't seem to figure out how to get this missing extension and haven't found a solution that works for me after a few hours of googling.我似乎无法弄清楚如何获得这个丢失的扩展,并且在谷歌搜索几个小时后没有找到适合我的解决方案。 I just reformatted my mac dealing with a different server environment issue, so I don't mind reinstalling again and starting over, but I want to try to fix the issue without doing so if possible.我刚刚重新格式化了我的 mac 来处理不同的服务器环境问题,所以我不介意重新安装并重新开始,但我想尽可能地尝试解决问题而不这样做。 Any help is greatly appreciated!任何帮助是极大的赞赏!

* EDIT * Output for php -m * 编辑 * 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

Why does the composer error show that you are using php5?为什么composer错误显示你使用的是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.

Are you using php5 before?你以前用过php5吗? If yes, I think you can try uninstall the php5 first.如果是,我认为您可以先尝试卸载 php5。

Run this on terminal: sudo apt-get install php7.2-zip && sudo apt-get install php-zip.在终端上运行:sudo apt-get install php7.2-zip && sudo apt-get install php-zip。 After which you would run the command (sudo composer global require "laravel/installer")之后你将运行命令(sudo composer global require "laravel/installer")

At first you have to install php extension zip.首先你必须安装 php extension zip。 To do the installation just run the following要进行安装,只需运行以下命令

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

Now you can try again to install laravel installer using composer现在您可以再次尝试使用 composer 安装 laravel 安装程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Composer Install:系统中缺少所请求的PHP扩展zip - Composer Install : the requested PHP extension zip is missing from your system 我无法使用 Composer 安装 Laravel(缺少 ext-zip 扩展名) - I cannot install Laravel with Composer (ext-zip extension is missing) 您的系统中没有处理“所请求的PHP扩展名pdo_sqlite”。 ”在运行composer安装时 - Dealing with “the requested PHP extension pdo_sqlite is missing from your system. ” when running composer install 尝试使用Composer安装laravel时出现PHP版本错误 - Error with php version when trying to install laravel with composer 尝试通过Composer安装Laravel 5时发生PHP致命错误 - PHP Fatal error when trying to install Laravel 5 with Composer laravel composer update:系统中缺少所请求的PHP扩展dom - laravel composer update : the requested PHP extension dom is missing from your system dompdf / dompdf v0.7.0要求ext-gd *->请求的PHP扩展名gd丢失,laravel composer-docker安装 - dompdf/dompdf v0.7.0 requires ext-gd * -> the requested PHP extension gd is missing, laravel composer-install with docker php composer安装IMAP时遇到问题-laravel - Having trouble php composer install IMAP missing - laravel 从zip文件安装composer-php插件 - install composer-php plugin from zip file 您的系统缺少扩展名 gd - laravel 作曲家更新 - Extension gd is missing from your system - laravel composer Update
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM