Closed tcpadmin closed 5 years ago
*** applying m190908_055507_init_data 是否生成测试问题数据? (yes|no) [yes]: [> ] 0% (0/100) ETA: n/a > execute SQL: INSERT INTO {{%merit_template}} (`id`, `type`, `title`, `unique_id`, `method`, `event`, `action_type`, `rule_key`, `rule_value`, `increment`, `status`, `created_at`, `updated_at`) VALUES (1, 1, '登录', 'site/login', 2, 0, 2, 1, 1, 2, 1, 1458657160, 1458823425), (2, 1, '发帖', 'topic/default/create', 2, 0, 2, 0, NULL, 6, 1, 1458657218, 1458657218), (3, 1, '回复', 'topic/comment/create', 2, 0, 2, 0, NULL, 4, 1, 1458657251, 1458657251), (4, 1, '发动弹', 'tweet/default/create', 2, 0, 2, 0, NULL, 4, 1, 1458657296, 1468647701); ... done (time: 0.001s) Exception 'yii\base\InvalidConfigException' with message 'Please configure UrlManager::hostInfo correctly as you are running a console application.' in /data/coding/php/do-test/getyii/vendor/yiisoft/yii2/web/UrlManager.php:633 Stack trace: #0 /data/coding/php/do-test/getyii/vendor/yiisoft/yii2/helpers/BaseUrl.php(228): yii\web\UrlManager->getHostInfo() #1 /data/coding/php/do-test/getyii/frontend/modules/topic/models/Topic.php(128): yii\helpers\BaseUrl::to('/member/admin', true) #2 /data/coding/php/do-test/getyii/vendor/yiisoft/yii2/db/ActiveRecord.php(596): frontend\modules\topic\models\Topic->beforeSave(true) #3 /data/coding/php/do-test/getyii/vendor/yiisoft/yii2/db/ActiveRecord.php(566): yii\db\ActiveRecord->insertInternal(NULL) #4 /data/coding/php/do-test/getyii/vendor/yiisoft/yii2/db/BaseActiveRecord.php(678): yii\db\ActiveRecord->insert(true, NULL) #5 /data/coding/php/do-test/getyii/console/migrations/m190908_055507_init_data.php(71): yii\db\BaseActiveRecord->save() #6 /data/coding/php/do-test/getyii/console/migrations/m190908_055507_init_data.php(17): m190908_055507_init_data->generateFakeData(64) #7 /data/coding/php/do-test/getyii/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(725): m190908_055507_init_data->up() #8 /data/coding/php/do-test/getyii/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(199): yii\console\controllers\BaseMigrateController->migrateUp('m190908_055507_...') #9 [internal function]: yii\console\controllers\BaseMigrateController->actionUp(0) #10 /data/coding/php/do-test/getyii/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array) #11 /data/coding/php/do-test/getyii/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array) #12 /data/coding/php/do-test/getyii/vendor/yiisoft/yii2/console/Controller.php(148): yii\base\Controller->runAction('up', Array) #13 /data/coding/php/do-test/getyii/vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('up', Array) #14 /data/coding/php/do-test/getyii/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('migrate/up', Array) #15 /data/coding/php/do-test/getyii/console/controllers/InstallController.php(163): yii\console\Application->runAction('migrate/up', Array) #16 [internal function]: console\controllers\InstallController->actionMigrate() #17 /data/coding/php/do-test/getyii/console/controllers/InstallController.php(55): call_user_func_array(Array, Array) #18 /data/coding/php/do-test/getyii/console/controllers/InstallController.php(34): console\controllers\InstallController->runSteps(Array) #19 [internal function]: console\controllers\InstallController->actionIndex() #20 /data/coding/php/do-test/getyii/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array) #21 /data/coding/php/do-test/getyii/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array) #22 /data/coding/php/do-test/getyii/vendor/yiisoft/yii2/console/Controller.php(148): yii\base\Controller->runAction('', Array) #23 /data/coding/php/do-test/getyii/vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('', Array) #24 /data/coding/php/do-test/getyii/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('install', Array) #25 /data/coding/php/do-test/getyii/vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('install', Array) #26 /data/coding/php/do-test/getyii/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(yii\console\Request)) #27 /data/coding/php/do-test/getyii/yii(31): yii\base\Application->run() #28 {main}
@tcpadmin 用这个方法尝试解决看看https://stackoverflow.com/questions/33298305/createabsoluteurl-does-not-work-in-console-app
我之前用得挺好得
感谢,已经解决,在console里配置好就可以了