Console problem with "php yii"

Good day.

I have yii2 v2.0.12 avdanced

Installed i18n like here

After that - removed project to other server… Installed all vendors and so on

and now have error after command "php yii"

[root@226 workflow]# php yii

Exception 'yii\base\InvalidConfigException' with message 'Unable to determine the request URI.'

in /var/www/workflow/vendor/yiisoft/yii2/web/Request.php:858

Stack trace:

#0 /var/www/workflow/vendor/yiisoft/yii2/web/Request.php(818): yii\web\Request->resolveRequestUri()

#1 /var/www/workflow/common/components/LangRequest.php(16): yii\web\Request->getUrl()

#2 /var/www/workflow/common/components/LangRequest.php(32): common\components\LangRequest->getLangUrl()

#3 /var/www/workflow/vendor/yiisoft/yii2/web/Request.php(727): common\components\LangRequest->resolvePathInfo()

#4 /var/www/workflow/vendor/yiisoft/yii2/web/UrlManager.php(289): yii\web\Request->getPathInfo()

#5 /var/www/workflow/vendor/yiisoft/yii2/web/Request.php(184): yii\web\UrlManager->parseRequest(Object(common\components\LangRequest))

#6 /var/www/workflow/vendor/yiisoft/yii2/console/Application.php(145): yii\web\Request->resolve()

#7 /var/www/workflow/vendor/yiisoft/yii2/base/Application.php(380): yii\console\Application->handleRequest(Object(common\components\LangRequest))

#8 /var/www/workflow/yii(27): yii\base\Application->run()

#9 {main}

Cant find solvation…

How can i fix it?


Seems your environment is using web PHP binary for command line. It’s wrong and correct binary should be used instead.

Hi sandmark, I have the same problem, but I don’t know how to solve, you can be a little more specific about how to change to php cli intead of web php.

PD: I think that the problem begin when I update composer and change PHP version to 7.2

root@jmartin-Inspiron-580:/var/www/html/mini-backup-manager# ./yii migrate
Exception 'yii\base\InvalidConfigException' with message 'Unable to determine the request URI.'

in /var/www/html/mini-backup-manager/vendor/yiisoft/yii2/web/Request.php:1009

Hi, I solved my problem. I forgot that I was working with an api in other branch, so I force on my main-local the request to “yii/web/Request”:

        'request' => [
        'class' => 'yii\web\Request',
        'parsers' => [
            'application/json' => 'yii\web\JsonParser',


I commented and that was! jajajaja