The web.php are differnt. The one in the bàsic file seems more evoluted and not compatible.
Check this:
<?php
$params = require(__DIR__ . '/params.php');
$config = [
'id' => 'basic',
'basePath' => dirname(__DIR__),
'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'),
'components' => [
'cache' => [
'class' => 'yii\caching\FileCache',
],
'user' => [
'identityClass' => 'app\models\User',
'enableAutoLogin' => true,
],
'errorHandler' => [
'errorAction' => 'site/error',
],
'mail' => [
'class' => 'yii\swiftmailer\Mailer',
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=yf2',
'username' => 'root',
'password' => 'mypass',
'charset' => 'utf8',
],
],
'params' => $params,
];
if (YII_ENV_DEV) {
// configuration adjustments for 'dev' environment
$config['preload'][] = 'debug';
$config['modules']['debug'] = 'yii\debug\Module';
$config['modules']['gii'] = 'yii\gii\Module';
}
if (YII_ENV_TEST) {
// configuration adjustments for 'test' environment.
// configuration for codeception test environments can be found in codeception folder.
// if needed, customize $config here.
}
return $config;
And the one in the tutorial:
<?php
return array(
'id' => 'app',
// Preload the Debug Module
'preload' => array(
'debug'
),
'basePath' => dirname(__DIR__),
'extensions' => require(__DIR__ . '/../vendor/yiisoft/extensions.php'),
// Components
'components' => array(
// UrlManager
'urlManager' => array(
'class' => 'yii\web\UrlManager',
// Disable index.php
'showScriptName' => false,
// Disable r= routes
'enablePrettyUrl' => true
),
// Caching
'cache' => array(
'class' => 'yii\caching\FileCache'
),
// UserIdentity
'user' => array(
'identityClass' => 'app\models\User',
),
// Logging
'log' => array(
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => array(
array(
'class' => 'yii\log\FileTarget',
'levels' => array('error', 'warning')
)
)
),
// Database
'db' => array(
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=yf2',
'username' => 'root',
'password' => 'mypass',
'charset' => 'utf8'
)
),
// Modules
'modules' => array(
'debug' => 'yii\debug\Module',
'gii' => 'yii\gii\Module'
),
// Extra Params if we want them
'params' => array()
);