Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I've succesfully created and uploaded advanced template on my shared host.

As next step, I must run the yii migrate.

But I cannot because I've not the console access.

What could you suggest to me?

Please note that

  • I cannot change the host, because it's not a decision of mine
  • I cannot access the server using SSH
  • I've already tried something like PHPShell, but I got permissione denied when trying to runyii migrate --interactive=0

I tried also this: added an actionMigrateUp to frontend/controllers/siteController.php

public function actionMigrateUp()
{
    // https://github.com/yiisoft/yii2/issues/1764#issuecomment-42436905
    $oldApp = Yii::$app;
    new yiiconsoleApplication([
        'id'            => 'Command runner',
        'basePath'      => '@app',
        'components'    => [
            'db' => $oldApp->db,
        ],
    ]);
    Yii::$app->runAction('migrate/up', ['migrationPath' => '@console/migrations/', 'interactive' => false]);
    Yii::$app = $oldApp;
}

But when I visit /frontend/web/index.php?r=site/migrateUp I got a 404

exception 'yiiaseInvalidRouteException' with message 'Unable to resolve the request: site/migrateUp' in C:xampphtdocswwwvendoryiisoftyii2aseController.php:122

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
388 views
Welcome To Ask or Share your Answers For Others

1 Answer

The action that you have created is not accesible with

/frontend/web/index.php?r=site/migrateUp

but with

/frontend/web/index.php?r=site/migrate-up

Otherwise everything should be fine.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...