搜尋
首頁php教程php手册解决Composer should be invoked via the CLI version o

在运行的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

陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

將Eclipse與SAP NetWeaver應用伺服器整合。

DVWA

DVWA

Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

VSCode Windows 64位元 下載

VSCode Windows 64位元 下載

微軟推出的免費、功能強大的一款IDE編輯器