Unable to determine the entry script file path

Hello All,

I use Yii2 as library for my native php project. it’s work fine when i use web page. but i got problem in my CLI script.

i got error:

PHP Fatal error: Uncaught yii\base\InvalidConfigException: Unable to determine the entry script file path. in yii2-framework/web/Request.php:850
Stack trace:
#0 yii2-framework/web/Application.php(66): yii\web\Request->getScriptFile()
#1 yii2-framework/base/Application.php(273): yii\web\Application->bootstrap()
#2 yii2-framework/base/BaseObject.php(109): yii\base\Application->init()
#3 yii2-framework/base/Application.php(206): yii\base\BaseObject->__construct(Array)
#4 loader.php(15): yii\base\Application->__construct(Array)

my configuration:
new yii\web\Application([
‘id’ => ‘app’,
‘basePath’ => DIR_APP,
‘components’ => $components,
]);

You are trying to use web application from console. You should instantiate yii\console\Application instead of yii\web\Application.

2 Likes

thank you, i will recheck my script.