我正在尝试首次使用composer安装Laravel。
按照https://laravel.com/docs/5.1的文档进行操作之后,我尝试使用命令sudo composer global require "laravel/installer"
进行操作。
我得到的输出粘贴在下面:
Changed current directory to /home/israel/.composer
Using version ^2.0 for laravel/installer
./composer.json has been created
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 those .ini files:
- /etc/php/7.2/cli/php.ini
- /etc/php/7.2/cli/conf.d/10-opcache.ini
- /etc/php/7.2/cli/conf.d/10-pdo.ini
- /etc/php/7.2/cli/conf.d/15-xml.ini
- /etc/php/7.2/cli/conf.d/20-calendar.ini
- /etc/php/7.2/cli/conf.d/20-ctype.ini
- /etc/php/7.2/cli/conf.d/20-curl.ini
- /etc/php/7.2/cli/conf.d/20-dom.ini
- /etc/php/7.2/cli/conf.d/20-exif.ini
- /etc/php/7.2/cli/conf.d/20-fileinfo.ini
- /etc/php/7.2/cli/conf.d/20-ftp.ini
- /etc/php/7.2/cli/conf.d/20-gettext.ini
- /etc/php/7.2/cli/conf.d/20-iconv.ini
- /etc/php/7.2/cli/conf.d/20-json.ini
- /etc/php/7.2/cli/conf.d/20-mbstring.ini
- /etc/php/7.2/cli/conf.d/20-phar.ini
- /etc/php/7.2/cli/conf.d/20-posix.ini
- /etc/php/7.2/cli/conf.d/20-readline.ini
- /etc/php/7.2/cli/conf.d/20-shmop.ini
- /etc/php/7.2/cli/conf.d/20-simplexml.ini
- /etc/php/7.2/cli/conf.d/20-sockets.ini
- /etc/php/7.2/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.2/cli/conf.d/20-sysvsem.ini
- /etc/php/7.2/cli/conf.d/20-sysvshm.ini
- /etc/php/7.2/cli/conf.d/20-tokenizer.ini
- /etc/php/7.2/cli/conf.d/20-wddx.ini
- /etc/php/7.2/cli/conf.d/20-xmlreader.ini
- /etc/php/7.2/cli/conf.d/20-xmlwriter.ini
- /etc/php/7.2/cli/conf.d/20-xsl.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, deleting ./composer.json.
这是否意味着未安装PHP?
答案 0 :(得分:1)
如果您尝试
sudo apt-get install php7.2-zip
,您遇到了错误:
sudo: apt-get: command not found
然后,尝试使用自制软件:
brew install php
这对我有用。希望它可以节省一些额外的时间,例如:祝您编程愉快!
答案 1 :(得分:0)
看看Laravel的要求:
union all
你遇到他们吗?您的错误消息指出,您的环境不符合PHP版本和扩展名,因此您必须先安装它们。 一旦安装了正确的PHP版本和相应的扩展,composer将能够根据需要安装laravel。
希望这会有所帮助! :)
答案 2 :(得分:0)
只需运行sudo apt-get install php7.2-zip && sudo apt-get install php-zip
。之后,您将再次运行命令(sudo composer global require "laravel/installer"
)。
它应该可以正常工作。
它确实做到了。 :)