Начал проходить по мануалу "Создание блога". Все подготовил, вроде бы как настроил. Дошел до генерации каркаса и создания моделей. И тут вылезла первая проблема
Делаю все на локали (у меня ubunt'а). Создал нужную базу. Залил дамп schema.mysql.sql
Поднастроил конфиг:
Код: Выделить всё
<?php
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'Test App',
// preloading 'log' component
'preload'=>array('log'),
// autoloading model and component classes
'import'=>array(
'application.models.*',
'application.components.*',
),
'modules'=>array(
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'********',
'ipFilters'=>array('127.0.0.1','::1'),
),
),
// application components
'components'=>array(
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=yii_testdrive',
'emulatePrepare' => true,
'username' => 'root',
'password' => '********',
'charset' => 'utf8',
'tablePrefix' => 'tbl_',
'enableProfiling' => true,
'enableParamLogging' => true
),
'urlManager'=>array(
'urlFormat' => 'path', // ЧПУ
'showScriptName' => false, // скрываем index.php из url
'urlSuffix' => '.html'
),
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class' => 'ext.db_profiler.DbProfileLogRoute',
'countLimit' => 1, // How many times the same query should be executed to be considered inefficient
'slowQueryMin' => 0.01, // Minimum time for the query to be slow
),
),
),
// application-level parameters that can be accessed
// using Yii::app()->params['paramName']
'params'=>array(
// this is used in contact page
'adminEmail'=>'[email protected]',
),
'errorHandler'=>array(
// use 'site/error' action to display errors
'errorAction'=>'site/error',
),
),
);
Код: Выделить всё
<?php
if($_SERVER['HTTP_HOST']=='yii_testdrive') {
defined('YII_DEBUG') or define('YII_DEBUG', true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
$yii=dirname(__FILE__).'/../yii/framework/yii.php';
$config=dirname(__FILE__).'/protected/config/main.php';
}
else {
defined('YII_DEBUG') or define('YII_DEBUG', false);
// disable error and exeption checking
define('YII_ENABLE_ERROR_HANDLER', false);
define('YII_ENABLE_EXCEPTION_HANDLER', false);
$yii=dirname(__FILE__).'/../yii/framework/yiilite.php';
$config=dirname(__FILE__).'/protected/config/production.php';
}
require_once($yii);
Yii::createWebApplication($config)->run();
Почему это может происходить?CException
Object configuration must be an array containing a "class" element.
/home/nomen/workspace/yii/framework/YiiBase.php(195)
...
#16
– /home/nomen/workspace/yii_testdrive/index.php(25): CApplication->run()
$yii=dirname(__FILE__).'/../yii/framework/yiilite.php';
$config=dirname(__FILE__).'/protected/config/production.php';
}
require_once($yii);
Yii::createWebApplication($config)->run(); <----- (ошибка в момент выполнения здесь)