Yii2 Advanced installation throws error 'Document root “/var/www/html/project/console/web” does not exist.' while running php Yii serve

核能气质少年 提交于 2020-12-30 08:05:48

问题


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?


回答1:


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




回答2:


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;



回答3:


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.



来源:https://stackoverflow.com/questions/39254845/yii2-advanced-installation-throws-error-document-root-var-www-html-project-co

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!