我非常喜欢这个社区!而且现在看来我需要一个人问一个问题,因为目前我在Google方面不走运。
因此,我无法启动PHP网站。它给出了这样的错误:
Fatal error: Uncaught exception 'yii\base\InvalidConfigException' with message 'The "id" configuration for the Application is required.' in /var/www/www-root/data/www/abc/vendor/yiisoft/yii2/base/Application.php:220 Stack trace: #0 /var/www/www-root/data/www/abc/vendor/yiisoft/yii2/base/Application.php(202): yii\base\Application->preInit(Array) #1 /var/www/www-root/data/www/somewebsite.com/index.php(20): yii\base\Application->__construct(Array) #2 {main} thrown in /var/www/www-root/data/www/abc/vendor/yiisoft/yii2/base/Application.php on line 220
我的index.php是:
<?php
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'prod');
ini_set('session.save_path', 'tmp');
session_start();
require(__DIR__ . '/../abc/vendor/autoload.php');
require(__DIR__ . '/../abc/vendor/yiisoft/yii2/Yii.php');
require(__DIR__ . '/../abc/common/config/bootstrap.php');
require(__DIR__ . '/../abc/common/config/bootstrap.php');
$config = yii\helpers\ArrayHelper::merge(
require(__DIR__ . '/../abc/common/config/main.php'),
require(__DIR__ . '/../abc/common/config/main-local.php'),
require(__DIR__ . '/../abc/common/config/main.php'),
require(__DIR__ . '/../abc/common/config/main-local.php')
);
$application = new yii\web\Application($config);
$application->run();
?>
有什么问题?我根据他们的手册安装了Yii框架。
答案 0 :(得分:1)
您尝试过配置文件(即main.php)
return [
'id' => 'app-frontend-example',
]
答案 1 :(得分:0)
您在配置目录中的配置文件main.php应该返回
......
return [
'id' => 'your_app_if',
'name' => Your App Name ',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'controllerNamespace' => 'your_application\controllers', // the namespace for you application controller
'modules' => [],
'components' => [
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'errorHandler' => [
'errorAction' => 'site/error',
],
],
'params' => $params,
];