Yii Playground setup error

Anybody setup Yii Playground on their computer before? http://code.google.com/p/yiiplayground/downloads/list

Does it require special DB connection? Why they built a DB manager? Please tell me what you think. Thank you!

I exactly followed the install.txt, but got the following error:

it


PHP Error


Undefined index: r


C:\xampp\htdocs\yii_playground\protected\components\DbManager.php(11)


01 <?php

02 class DbManager extends CApplicationComponent{

03 

04     public function init() {

05         parent::init();

06         // if we already have a connection, we quit

07         // this will allow user to set up a custom one

08         if (Yii::app()->db->active)

09             return;

10         

11         if ($_GET['r'] == 'site/createUserDb')

12             return;

13 

14         if ($this->dbExists()) {

15             Yii::app()->db->connectionString ='sqlite:'.Yii::app()->params['user_db'];

16             Yii::app()->db->setActive(true);

17         } else {            

18             $this->resetUserDb();            

19         }

20     }

21 

22 

23     protected function dbExists() {


Stack Trace

#0 	

+

–

 C:\xampp\htdocs\yii\framework\base\CModule.php(372): DbManager->init()


367             if(!isset($config['enabled']) || $config['enabled'])

368             {

369                 Yii::trace("Loading \"$id\" application component",'system.CModule');

370                 unset($config['enabled']);

371                 $component=Yii::createComponent($config);

372                 $component->init();

373                 return $this->_components[$id]=$component;

374             }

375         }

376     }

377 


#1 	

+

–

 C:\xampp\htdocs\yii\framework\base\CModule.php(477): CModule->getComponent("dbManager")


472      * Loads static application components.

473      */

474     protected function preloadComponents()

475     {

476         foreach($this->preload as $id)

477             $this->getComponent($id);

478     }

479 

480     /**

481      * Preinitializes the module.

482      * This method is called at the beginning of the module constructor.


#2 	

+

–

 C:\xampp\htdocs\yii\framework\base\CApplication.php(139): CModule->preloadComponents()


134         $this->initSystemHandlers();

135         $this->registerCoreComponents();

136 

137         $this->configure($config);

138         $this->attachBehaviors($this->behaviors);

139         $this->preloadComponents();

140 

141         $this->init();

142     }

143 

144 


#3 	

+

–

 C:\xampp\htdocs\yii\framework\YiiBase.php(118): CApplication->__construct("C:\xampp\htdocs\yii_playground/protected/config/development.php")


113      * @return mixed the application instance

114      * @since 1.0.10

115      */

116     public static function createApplication($class,$config=null)

117     {

118         return new $class($config);

119     }

120 

121     /**

122      * @return CApplication the application singleton, null if the singleton has not been created yet.

123      */


#4 	

+

–

 C:\xampp\htdocs\yii\framework\YiiBase.php(91): YiiBase::createApplication("CWebApplication", "C:\xampp\htdocs\yii_playground/protected/config/development.php")


86      * which should point to the directory containing all application logic, template and data.

87      * If not, the directory will be defaulted to 'protected'.

88      */

89     public static function createWebApplication($config=null)

90     {

91         return self::createApplication('CWebApplication',$config);

92     }

93 

94     /**

95      * Creates a console application instance.

96      * @param mixed $config application configuration.


#5 	

+

–

 C:\xampp\htdocs\yii_playground\index.php(11): YiiBase::createWebApplication("C:\xampp\htdocs\yii_playground/protected/config/development.php") 

Here is the install.txt:

===========================================

Yii Playground: how to set it up.

===========================================

  1. download the latest version of Yii Framework from

http://www.yiiframework.com/download/

  1. setup the Yii Framework:

http://www.yiiframework.com/doc/guide/quickstart.installation

  1. download Yii Playground from svn or from the latest

snapshot from the google code project page:

http://code.google.com/p/yiiplayground/

  1. place the Yii Playground files into a Web-accessible directory

  2. copy the file index.example to index.php

  3. open index.php and set the path to your yii.php script

(located inside the Yii Framework folder)

  1. if you are using a posix-compliant system, like linux, give

777 permissions to the folder protected/data/

8) open Yii Playground in your browser and have fun ;)

BTW, I am using Windows, no permission issue.

Nope,

that’s is an old bug from Yii Playground, but AFAIK Giovanni (the owner of the Yii Playground) has updated to the latest…

so the bug should has been gone…

but you can fix it if you want

actually it just because lack of isset(), so you just need go to your C:\xampp\htdocs\yii_playground\protected\components\DbManager.php

then change the code line 11 into this


 if (isset($_GET['r'] && $_GET['r'] == 'site/createUserDb')

Thanks a lot!! There is no way I can know it by myself.

The original code is


if ($_GET['r'] == 'site/createUserDb') 

return;

I copied your code, but it’s still not working, and then I changed it a little bit, and then it works!~

This is my code:


if (isset($_GET['r']) && ($_GET['r'] == 'site/createUserDb'))

			return;

Actually I don’t know why it works… can you explain?

Thanks!

oh yeah, sorry I’ve forgot to close the parentheses :P

this error will show up only if you set the error reporting to the level E_ALL or E_NOTICE. E_ALL is the default setting of WAMP (while XAMPP default is E_ERROR)

since E_ALL is very fuzzy, a little notice would be count fatal error. that’s why you got that error~

Thanks for introducing error_reporting = E_ALL | E_STRICT (in php.ini) knowledge point for me. It’s amazing to know one point has relations to many other knowledge points.

thank… for informations:D

Hello All,

you may also try …

if (@$_GET[‘r’] == ‘site/createUserDb’)