Using Console commands into web context

Hello everyone,

I have been working on an application auto installer and currently stuck on migrating the tables from the files into the database without using the console.

I have searched google but was unable to find anything useful.

I have tried using the following code but anything happens and the server issues the Internal Server Error.

Is there anyway that I can achieve my goal




<?php

new yii\console\Application([

				'id'         => 'auto-migrate',

				'basePath'   => dirname(__DIR__),

				'components' => [

					         'db' => [

						           'class'    => 'yii\\db\\Connection',

						           'dsn'      => 'mysql:host=localhost;dbname=starter-kit',

						           'username' => 'root',

						           'password' => '',

						           'charset'  => 'utf8',

					                ],

				                ]

	                ]);

Yii::$app->runAction('migrate', ['migrationPath'=>'@vendor/abhi1693/yii2-user/migrations','interactive' => FALSE]);