Tag Archives: yii error

[Solved] yii error: Setting unknown property: yii\console\Request: :cookieValidationKey

1. Command:
php yii
2. Error:
Exception ‘yii\base\UnknownPropertyException’ with message ‘Setting unknown property: yii\console\Request::cookieValidationKey’
3. Reason:
console/yii file

$config = yii\helpers\ArrayHelper::merge(
    require __DIR__ . '/config/main.php',
    require __DIR__ . '/../conf/main-local.php'
);

$application = new yii\console\Application($config);

The above program execution entry combines all configurations before actual operation, and some configuration parameters are invalid for console operation

4. Solution:
Delete these parameters before performing console operations

unset($config['components']['request']);
$application = new yii\console\Application($config);