duanmibei1929 2016-08-05 10:12
浏览 140
已采纳

在linux服务器上设置未知属性:yii \ console \ ErrorHandler :: errorAction

I just uploaded my yii advanced project to my centos server, but I can't seem to get past the migrate phase. When I try to run yii migrate the following error occurred:

`Setting unknown property: yii\console\ErrorHandler::errorAction'

I have no idea why this happens, because it works fine when I run it locally on my windows computer.

My yii advance project is bit different than a normal Yii advanced. The backend has been separated from the frontend so it just contains the console and frontend directory.

common/config/main.php

$config = require(__DIR__ . '/main-console.php');
array_push($config['bootstrap'], 'site');
$config['components']['errorHandler'] = [
    'errorAction' => 'site/error',
];
$config['components']['user'] = [
    'identityClass' => 'frontend\models\User',
    'enableAutoLogin' => true,
];

$config['components']['session'] = [
    'name' => 'PHPFRONTSESSID',
    'savePath' => sys_get_temp_dir(),
];

$config['components']['request'] = [
    'cookieValidationKey' => 'IBzCJMjLWUaXMZemYUej',
    'csrfParam' => '_frontendCSRF',
];

$config['components']['site'] = [
    'class' => 'frontend\components\SiteComponent',
];

return $config;

main-console.php

$params = array_merge(
    require(__DIR__ . '/params.php')
);

return [
    'id' => 'app-frontend',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log','debug'],
    'sourceLanguage' => 'en-US',
    'controllerNamespace' => 'frontend\controllers',
    'aliases' => [
        '@local_media' => '@frontend/web/uploads/media',
    ],
    'modules' => [
        'debug' => [
            'class' => 'yii\debug\Module',
        ],
    ],
    'components' => [
        'cache' => [
            'class' => 'yii\caching\FileCache',
        ],
        'i18n' => [
            'translations' => [
                'app*' => [
                    'class' => 'yii\i18n\PhpMessageSource',
                    'basePath' => '@frontend/messages',
                ],
            ],
        ],
        'assetManager' => [
            'bundles' => false,
        ],
        'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning', 'trace'],
                ],
            ],
        ],
        'defaultRoute' => 'site/view',
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => true,
            'enableStrictParsing' => false,
            'rules' => require('routes.php'),
        ],
    ],
    'params' => $params,
];

Can someone give me some advies on how to solve this problem?

  • 写回答

2条回答 默认 最新

  • dongzhanlu0658 2016-08-05 13:10
    关注

    You problem is that you specify error action into common/config/main.php. Error action must be used only with web apps, not console. So move this to your frontend and backend configs separately:

    $config['components']['errorHandler'] = [
        'errorAction' => 'site/error',
    ];
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 易语言把MYSQL数据库中的数据添加至组合框
  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况