WP-CLI仅显示所有输入选项的PHP版本

时间:2016-04-06 作者:Tosh

无论我将哪些输入参数传递给wp cli,我都会看到相同的输出。

[tosh@server94]$ wp-cli.phar --info
X-Powered-By: PHP/5.4.36
Content-type: text/html

[tosh@server94]$ wp-cli.phar help cache
X-Powered-By: PHP/5.4.36
Content-type: text/html
发生了什么事?

Update in response to Answer

我的主机服务器上似乎有2个PHP“安装”。似乎没有一个有效。第一种是cgi,有上述症状。第二个是cli版本,不输出任何内容。

[userx@server921 jack]$ /usr/bin/php wp-cli.phar --info
X-Powered-By: PHP/5.5.33
Content-type: text/html

[userx@server921 jack]$ /usr/bin/php -v
PHP 5.5.33 (cgi-fcgi) (built: Mar  3 2016 10:03:52)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
    with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v5.1.1, Copyright (c) 2002-2016, by ionCube Ltd.
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies
    with Zend Guard Loader v3.3, Copyright (c) 1998-2014, by Zend Technologies
    with Suhosin v0.9.37.1, Copyright (c) 2007-2014, by SektionEins GmbH
[userx@server921 jack]$ php -v
PHP 5.5.33 (cli) (built: Mar  3 2016 10:03:51)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
    with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v5.1.1, Copyright (c) 2002-2016, by ionCube Ltd.
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies
    with Zend Guard Loader v3.3, Copyright (c) 1998-2014, by Zend Technologies
    with Suhosin v0.9.37.1, Copyright (c) 2007-2014, by SektionEins GmbH
[userx@server921 jack]$ php wp-cli.phar --info
[userx@server921 jack]$

1 个回复
SO网友:David Kemp

尝试运行php wp-cli.phar

EDIT

看起来有点像php 在您的系统上未设置为使用php-cli (正在使用php-cgi 相反):

尝试运行:php -v

在我的机器上,我得到:

PHP 5.5.9-1ubuntu4.14 (cli) (built: Oct 28 2015 01:34:46) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
重要的一点是(cli) - 这意味着它是cli,而不是cgi版本。

相关推荐

WP-CLI插件安装导致PHP致命错误-在不在对象上下文中时使用$This

运行时sudo wp install plugin pluginname --allowroot它会导致错误:PHP致命错误:未捕获错误:在/var/www/html/wp-content/plugins/pluginname/blocks中不在对象上下文中时使用$this。菲律宾比索:89我们有一个自定义插件,其中包含以下内容: class Block{ public static function Run() { add_action(\'e