Hi I’ve just started learning yii and for some reason when I try to create a new migrate table I get this error
On that line is this
),
the entire page is this
<?php
// This is the configuration for yiic console application.
// Any writable CConsoleApplication properties can be configured here.
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'My Console Application',
// preloading 'log' component
'preload'=>array('log'),
// application components
/*'components'=>array(
'db'=>array(
'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
),*/
// uncomment the following to use a MySQL database
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=trackstar',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
),
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'error, warning',
),
),
),
),
);
qianggan
(qianggan@msn.com)
March 6, 2014, 8:31pm
#2
This should be a easy fix, check you parenthesis pair. You do have one extra "),".
I removed the extra )’
and I ended up with this error when I tried to create a table again
exception ‘CException’ with message 'Property “CConsoleApplication.db” is read o
nly.’ in C:\Users\username\Downloads\yii\framework\base\CComponent.php:170
Stack trace:
#0 C:\Users\username\Downloads\yii\framework\base\CModule.php(513): CCompon
ent->__set(‘db’, Array)
#1 C:\Users\username\Downloads\yii\framework\base\CApplication.php(161): CM
odule->configure(Array)
#2 C:\Users\username\Downloads\yii\framework\YiiBase.php(125): CApplication
->__construct(‘C:\wamp\www\tra…’)
#3 C:\Users\username\Downloads\yii\framework\YiiBase.php(113): YiiBase::cre
ateApplication(‘CConsoleApplica…’, ‘C:\wamp\www\tra…’)
#4 C:\Users\username\Downloads\yii\framework\yiic.php(23): YiiBase::createC
onsoleApplication(‘C:\wamp\www\tra…’)
#5 C:\wamp\www\trackstar\protected\yiic.php(7): require_once('C:\Users\Velvet…
')
#6 {main}
downloads\yii is where the downloaded version of yii that I got from yiiframework.com
inradius
(Stroud Travis)
March 7, 2014, 8:11pm
#4
I don’t think you mean to have ‘components’ commented out the way you have it.
// application components
/*'components'=>array(
'db'=>array(
'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
),*/
// uncomment the following to use a MySQL database
Should probably be
// application components
'components'=>array(
/*'db'=>array(
'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
),*/
// uncomment the following to use a MySQL database
And that being the case, you should probably add that ), back where it was since there will be a new array left opened.
OMG!!! That was the problem. I feel like an idiot. Thank you sooooo much