> php教程 > php手册 > 解决Composer should be invoked via the CLI version o

解决Composer should be invoked via the CLI version o

WBOY
풀어 주다: 2016-06-06 20:09:45
원래의
2305명이 탐색했습니다.

在运行的PHP FastCGI 环境中安装Composer时,遇到这个问题: drupalon@ lixiphp .com [~/public_html/demo/gitlist]# php composer.phar install Content-type: text/html Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcg

在运行的PHP FastCGI 环境中安装Composer时,遇到这个问题:

drupalon@lixiphp.com [~/public_html/demo/gitlist]# php composer.phar install
Content-type: text/html

Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI

Fatal error: Uncaught exception ‘ErrorException’ with message ‘Undefined index: argv’ in phar:///home5/drupalon/public_html/demo/gitlist/composer.phar/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php:57
Stack trace:
#0 phar:///home5/drupalon/public_html/demo/gitlist/composer.phar/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php(57): Composer\Util\ErrorHandler::handle(8, ‘Undefined index…’, ‘phar:///home5/d…’, 57, Array)
#1 phar:///home5/drupalon/public_html/demo/gitlist/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php(111): Symfony\Component\Console\Input\ArgvInput->__construct()
#2 phar:///home5/drupalon/public_html/demo/gitlist/composer.phar/src/Composer/Console/Application.php(83): Symfony\Component\Console\Application->run(NULL, Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 phar:///home5/drupalon/public_html/demo/gitlist/composer.phar/bin/composer(43): Composer\Console\Application->run()
#4 /home5/drupalon/public_html/demo/gitlist/c in phar:///home5/drupalon/public_html/demo/gitlist/composer.phar/vendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php on line 57

错误提示PHP Composer 无法在CGI/FastCGI 中安装,需要切换到 CLI 模式下安装。

composer-install-cli PHP Composer 需要切换到 CLI 模式下安装

Composer 解决方法

Symfony Fatal error: Uncaught exception ‘ErrorException’ with message ‘Undefined index: argv’ in Symfony/Component/Console/Input/ArgvInput.php:57

设置php.ini为以下值:

register_argc_argv=On

或者直接通过PHP CGI 命令行安装 Composer:

# curl -sS https://getcomposer.org/installer | php-cli

注意:PHP CLI 模式下默认register_argc_argv=On。

安装结果:

#!/usr/bin/env php
All settings correct for using Composer
Downloading…

Composer successfully installed to: /home5/drupalon/public_html/demo/gitlist/composer.phar
Use it: php composer.phar

查看Composer是否安装成功:

# php-cli composer.phar -V
Composer version 7b72ce1b51ea075911226bf604625fed82399559

(...)
Read the rest of 解决Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI (85 words)


© lixiphp for LixiPHP, 2013. | Permalink | No comment | Add to del.icio.us
Post tags: CLI, Composer, FastCGI, gitlist, Symfony

Feed enhanced by Better Feed from Ozh

관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 추천
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿