9

I have tried yii2 advanced installation, it works and the pages have been created. But to verify installation I used the command PHP YII serve. it throws the error

Document root "/var/www/html/highwaymotels/console/web" does not exist.

But when I check the advanced template github it has the same folder as mine. Am I doing anything wrong? else what is the issue here?

Danila Ganchar
  • 10,266
  • 13
  • 49
  • 75
Abel
  • 2,371
  • 3
  • 15
  • 29
  • 2
    please check your entry script path is `@app\web`, if not please set path when use run command like `php yii serve --docroot = "@app"`. Please view [github issue](https://github.com/yiisoft/yii2-app-advanced/issues/191) – Hiren Bhut Sep 23 '16 at 12:34

5 Answers5

26

yii serve --docroot="frontend/web/"

  • 2
    Thank you! The Yii documentation also forgets to mention the init command in the advanced documentation. One can also still add the port number if your trying to follow the documentation. `php ./init php yii serve --docroot="frontend/web/" --port=8888` – William Hammock Aug 20 '18 at 04:40
  • thank you. it must be silly for those yii2 users :) but it help us a lot. – Jacky Supit Apr 27 '20 at 10:25
1

I solve this problem by recreating the config/console.php file than I deleted by wanting to minimize the size of the PHP project.

<?php
$params = require(__DIR__ . '/params.php');

$config = [
    'id' => 'my-yii-application-console',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'controllerNamespace' => 'app\commands',
    'components' => [
        'cache' => [
            'class' => 'yii\caching\FileCache',
        ],
        'log' => [
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ]
    ],
    'params' => $params
];

return $config;
0

Change the Document Root Path to : var/www/html/project/frontend/web. It worked for me.There is no console/web directory if you look into the yii2 project installation.

0

if you used composer to install yii2 . and use yiisoft/yii2 maybe youre dealing with this issue to solve just install using yiisoft/yii2-app-basic repository.

rüff0
  • 906
  • 1
  • 12
  • 26
0

If you've already done php./init, then write this: php yii serve --docroot="frontend/web". Remember this: don't put "/" at the end of "web".

bay_beast
  • 11
  • 5