Magento2 Composer需要包似乎不起作用

问题描述 投票:0回答:1

在命令行上 - 我正在使用此命令:

/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问题。

php centos composer-php magento2 whm
1个回答
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身份运行作曲家的这个警告 - 这可能会产生安全问题。

© www.soinside.com 2019 - 2024. All rights reserved.