在命令行上- 我正在使用以下命令:
/opt/cpanel/composer/bin/composer require apptrian/image-optimizer:2.2.0
之后,我在屏幕上看到了这个
Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI
Do not run Composer as root/super user! See https://getcomposer.org/root for details
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
但是当我实际检查composer.json文件时,没有看到任何更改。 并运行作曲家更新,我得到:
[root@s132-148-137-252 public_html]# /opt/cpanel/composer/bin/composer update
X-Powered-By: PHP/7.0.31
Content-type: text/html; charset=UTF-8
Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
当我使用
检查php -v时/opt/cpanel/ea-php70/root/usr/bin/php -v
我明白了
PHP 7.0.31 (cli) (built: Jul 23 2018 21:29:04) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.31, Copyright (c) 1999-2017, by Zend Technologies
但是如果我只是简单地检查php -v
然后我得到-返回时不正确-(cgi-fcgi)
ea-php-cli Copyright 2017 cPanel, Inc.
PHP 7.0.31 (cgi-fcgi) (built: Jul 23 2018 21:29:24)
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.31, Copyright (c) 1999-2017, by Zend Technologies
如何纠正正在使作曲家工作的问题以及php-cli
问题。
答案 0 :(得分:0)
您的服务器似乎配置错误,并且正在使用SAPI PHP进行CLI调用。您应该明确使用PHP for CLI运行Composer:
/opt/cpanel/ea-php70/root/usr/bin/php /opt/cpanel/composer/bin/composer require apptrian/image-optimizer:2.2.0
顺便说一句:您应该认真对待以root身份运行composer的警告-这可能会造成安全问题。