Composer没有使用消息'Undefined index:argv'安装Uncaught异常'ErrorException'

时间:2013-01-01 07:07:49

标签: php symfony composer-php

将作曲家下载到我的远程网络主机后。我尝试运行命令“php composer.phar install”

一旦我按照文档中的说法运行此命令,我就会得到错误,就像没有明天一样。

nwrepai1@******** [~/public_html]# php composer.phar install
Content-type: text/html

<br />
<b>Fatal error</b>:  Uncaught exception 'ErrorException' with message 'Undefined index: argv' in phar:///home3/nwrepai1/public_html/composer.phar/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php:57
Stack trace:
#0 phar:///home3/nwrepai1/public_html/composer.phar/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php(57): Composer\Util\ErrorHandler::handle(8, 'Undefined index...', 'phar:///home3/n...', 57, Array)
#1 phar:///home3/nwrepai1/public_html/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php(98): Symfony\Component\Console\Input\ArgvInput-&gt;__construct()
#2 phar:///home3/nwrepai1/public_html/composer.phar/src/Composer/Console/Application.php(74): Symfony\Component\Console\Application-&gt;run(NULL, Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 phar:///home3/nwrepai1/public_html/composer.phar/bin/composer(37): Composer\Console\Application-&gt;run()
#4 /home3/nwrepai1/public_html/composer.phar(14): require('phar:///home3/n...')
#5 {main}
  thrown in <b>phar:///home3/nwrepai1/public_html/composer.phar/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php</b> on line <b>57</b><br />
nwrepai1@********* [~/public_html]#

我有什么遗漏吗?

3 个答案:

答案 0 :(得分:14)

我在共享主机上遇到了同样的问题。设置register_argc_argv = On后,它无效。

但是当我在shell中尝试“php-cli composer.phar”而不是“php composer.phar”时,它确实有效。

答案 1 :(得分:12)

您需要确保在php.ini中为CLI设置了register_argc_argv=on

答案 2 :(得分:0)

System.out.format("the values is %s and the other one is %s",value,otherValue)