问题
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