为什么来自README的作曲家指令在我申请时失败?
尝试如下但未通过:
# uname -a
Linux signal 3.10.0-123.8.1.el7.x86_64 #1 SMP Mon Sep 22 19:06:58 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
# php --version
PHP 5.4.16 (cli) (built: Oct 31 2014 12:59:36)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
# ls
LICENSE bootstrap.php detect.php index.php
README.md composer.json hooks templates
# composer create-project whichbrowser/server .
-bash: composer: command not found
# php composer create-project whichbrowser/server .
Could not open input file: composer
修改
[root@signal wb]# php -r "if (hash_file('SHA384', 'composer-setup.php') === 'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
Installer verified
[root@signal wb]# php composer-setup.php
All settings correct for using Composer
Downloading 1.2.1...
Composer successfully installed to: /var/www/html/sip-phone/tls/website/wb/composer.phar
Use it: php composer.phar
[root@signal wb]# php -r "unlink('composer-setup.php');"
[root@signal wb]# php composer.phar create-project whichbrowser/server .
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Installing whichbrowser/server (v2.0.12)
[InvalidArgumentException]
Project directory ./ is not empty.
create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]
[root@signal wb]#
答案 0 :(得分:1)
你没有安装作曲家,请安装它:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === 'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
编辑:
了解如何安装:https://getcomposer.org/download/
在非空目录中创建项目whichbrowser / server,尝试在空目录创建项目:
mkdir ./myproject
php composer.phar create-project whichbrowser/server ./myproject