无法运行控制台命令yii2

时间:2017-06-21 10:51:18

标签: yii2

我正在尝试运行yii,但无法执行此操作。我收到了以下错误:

commond:php yii

Exception 'yii\base\UnknownPropertyException' with message 'Setting unknown property: yii\console\Request::parsers'

in /var/www/html/alpha/html/vendor/yiisoft/yii2/base/Component.php:201

Stack trace:
#0 /var/www/html/alpha/html/vendor/yiisoft/yii2/BaseYii.php(529): yii\base\Component->__set('parsers', Array)
#1 /var/www/html/alpha/html/vendor/yiisoft/yii2/base/Object.php(105): yii\BaseYii::configure(Object(yii\console\Request), Array)
#2 [internal function]: yii\base\Object->__construct(Array)
#3 /var/www/html/alpha/html/vendor/yiisoft/yii2/di/Container.php(381): ReflectionClass->newInstanceArgs(Array)
#4 /var/www/html/alpha/html/vendor/yiisoft/yii2/di/Container.php(156): yii\di\Container->build('yii\\console\\Req...', Array, Array)
#5 /var/www/html/alpha/html/vendor/yiisoft/yii2/BaseYii.php(348): yii\di\Container->get('yii\\console\\Req...', Array, Array)
#6 /var/www/html/alpha/html/vendor/yiisoft/yii2/di/ServiceLocator.php(135): yii\BaseYii::createObject(Array)
#7 /var/www/html/alpha/html/vendor/yiisoft/yii2/console/Application.php(219): yii\di\ServiceLocator->get('request')
#8 /var/www/html/alpha/html/vendor/yiisoft/yii2/base/Application.php(380): yii\console\Application->getRequest()
#9 /var/www/html/alpha/html/yii(31): yii\base\Application->run()
#10 {main}

1 个答案:

答案 0 :(得分:2)

parsers属性位于yii\web\Request,而不是yii\console\Request

可能您已将控制台配置与已配置此属性的Web配置合并。如果是这样,请确保使用单独的request组件设置来设置控制台配置。如果不是configs的情况,则在控制台配置中删除此属性。