Can't get past Gii login page

I am a newbie to Yii and have been trying to get through creating my first Yii application from the ‘Getting Started’ section.

When I get to the section in regards to setting up and logging into Gii, everything goes fine until I actually try to log into the application. When I log in and provide the correct password (the one I set within the main.php file), it takes me back to the login prompt. If I provide an incorrect password, it gives me an error indicating the password is incorrect. So, I know it’s using my correct password. It’s like the page is in an infinite loop or it’s having problems loading the index.php page for some reason. Any ideas?

I also noticed that I get the following error in my apache error logs when using the Gii application (NOTE: C:/localwork/workspace_pprl is my Apache DocumentRoot):

[Thu Jun 03 04:59:52 2010] [error] [client 127.0.0.1] File does not exist: C:/localwork/workspace_pprl/testdrive/fancybox

[Thu Jun 03 04:59:52 2010] [error] [client 127.0.0.1] File does not exist: C:/localwork/workspace_pprl/testdrive/fancybox

[Thu Jun 03 04:59:52 2010] [error] [client 127.0.0.1] File does not exist: C:/localwork/workspace_pprl/testdrive/fancybox

[Thu Jun 03 04:59:52 2010] [error] [client 127.0.0.1] File does not exist: C:/localwork/workspace_pprl/testdrive/fancybox

[Thu Jun 03 04:59:52 2010] [error] [client 127.0.0.1] File does not exist: C:/localwork/workspace_pprl/testdrive/fancybox

[Thu Jun 03 04:59:52 2010] [error] [client 127.0.0.1] File does not exist: C:/localwork/workspace_pprl/testdrive/fancybox

I am using Apache 2.2.15 / PHP 5.2.3 on Windows XP with IE 7 and Firefox 3.6.3.

Any help would be greatly appreciated. I’ve been stuck here for a couple days now and have not been able to find anything on the web describing what may be going on.

Gii by default restricts access to localhost. Maybe that’s your problem? You have to configure the ipFilters parameter either to your IP address or to false to allow access from everywhere (dangerous though!).

Mike,

Well at least now I’m getting beyond the login page. I am now getting an access denied error…which I now need to research. :( I use http://localhost/testdrive/index.php?r=gii/default/login as my request

I first added the following IP filter, which didn’t do anything

[font=“Courier New”]‘ipFilters’ => array(‘127.0.0.1’,‘localhost’,‘172.20.10.186’),[/font]

I then added the dreaded ‘false’ setting, which then caused the access Error page:

[font=“Courier New”]‘ipFilters’=>array(‘false’),[/font]

Any suggestions? I saw there was a post earlier that didn’t have an answer on the fix…other than localhost is suppose to be the default.

From the (Gii Documentation, it says that access to Gii from localhost is enabled by default…which is what I’m doing.

I guess that really threw me off. I thought about adding localhost as a filter, but if it’s enabled by default…why would I. I’ll have to put in a change request to get that corrected in the documentation.

Any more help would be greatly appreciated.

The default behavior should work for most users i think, as no one ever complained, that it doesn’t.

From checking the code of GiiModule, this is the way Gii finds your current IP:


Yii::app()->request->userHostAddress

So maybe print that out from some action to see, what’s the actual IP address Gii is seeing for your client.

About access denied: What error do you get?

Sorry, didn’t see you pasted the error already. Maybe enable YII_DEBUG to see the complete call stack for that error?

Yes, I did verify that the


Yii::app()->request->userHostAddress

did return 127.0.0.1. Therefore, that explains why the addition of the ipFilters for localhost or 127.0.0.1 didn’t change anything.

If I set the ipFilters to ‘false’, I get the following error


in C:\localwork\workspace_pprl\testdrive\index.php (12)

2010/06/03 12:59:01 [error] [exception.CHttpException.403] exception 'CHttpException' with message 'You are not allowed to access this page.' in C:\localwork\workspace_pprl\yii\framework\gii\GiiModule.php:162

Stack trace:

#0 C:\localwork\workspace_pprl\yii\framework\web\CController.php(255): GiiModule->beforeControllerAction(Object(DefaultController), Object(CInlineAction))

#1 C:\localwork\workspace_pprl\yii\framework\web\CWebApplication.php(320): CController->run('login')

#2 C:\localwork\workspace_pprl\yii\framework\web\CWebApplication.php(120): CWebApplication->runController('gii/default/log...')

#3 C:\localwork\workspace_pprl\yii\framework\base\CApplication.php(135): CWebApplication->processRequest()

#4 C:\localwork\workspace_pprl\testdrive\index.php(12): CApplication->run()

#5 {main} REQUEST_URI=/testdrive/index.php?r=gii/default/login

2010/06/03 12:59:01 [trace] [system.CModule] Loading "errorHandler" application component

2010/06/03 12:59:01 [trace] [system.CModule] Loading "user" application component

in C:\localwork\workspace_pprl\yii\framework\gii\GiiModule.php (168)

2010/06/03 12:59:01 [trace] [system.CModule] Loading "session" application component

in C:\localwork\workspace_pprl\yii\framework\gii\GiiModule.php (168)

2010/06/03 12:59:01 [trace] [system.CModule] Loading "clientScript" application component

in C:\localwork\workspace_pprl\yii\framework\gii\views\layouts\main.php (2)

in C:\localwork\workspace_pprl\yii\framework\gii\views\layouts\column1.php (7)

in C:\localwork\workspace_pprl\yii\framework\gii\controllers\DefaultController.php (27)

2010/06/03 12:59:01 [trace] [system.CModule] Loading "assetManager" application component

in C:\localwork\workspace_pprl\yii\framework\gii\GiiModule.php (136)

in C:\localwork\workspace_pprl\yii\framework\gii\views\layouts\main.php (3)

in C:\localwork\workspace_pprl\yii\framework\gii\views\layouts\column1.php (7)



So I would like to stick with the localhost issue without turning off the ipFilters. In addition to getting the errors from the apache server (mentioned in original post), I get the following from the apache access logs


127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/index.php?r=gii/default/login HTTP/1.1" 200 2403

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/assets/4e9f0adc/css/screen.css HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/assets/4e9f0adc/css/print.css HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/assets/4e9f0adc/css/ie.css HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/assets/4e9f0adc/css/main.css HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/assets/4e9f0adc/js/fancybox/jquery.fancybox-1.3.1.css HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/assets/c4b0baf3/jquery.js HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/assets/4e9f0adc/js/tools.tooltip-1.1.3.min.js HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/assets/4e9f0adc/js/fancybox/jquery.fancybox-1.3.1.pack.js HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/assets/4e9f0adc/js/main.js HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/assets/4e9f0adc/images/logo.png HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/assets/4e9f0adc/js/fancybox/blank.gif HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/fancybox/fancy_loading.png HTTP/1.1" 404 234

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/fancybox/fancy_close.png HTTP/1.1" 404 232

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/fancybox/fancy_nav_right.png HTTP/1.1" 404 236

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/fancybox/fancy_nav_left.png HTTP/1.1" 404 235

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/fancybox/fancy_shadow_nw.png HTTP/1.1" 404 236

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/fancybox/fancy_shadow_w.png HTTP/1.1" 404 235

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/fancybox/fancy_shadow_sw.png HTTP/1.1" 404 236

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/fancybox/fancy_shadow_s.png HTTP/1.1" 404 235

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/fancybox/fancy_shadow_se.png HTTP/1.1" 404 236

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/fancybox/fancy_shadow_e.png HTTP/1.1" 404 235

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/fancybox/fancy_shadow_ne.png HTTP/1.1" 404 236

127.0.0.1 - - [03/Jun/2010:12:54:21 -0400] "GET /testdrive/fancybox/fancy_shadow_n.png HTTP/1.1" 404 235

127.0.0.1 - - [03/Jun/2010:12:54:23 -0400] "POST /testdrive/index.php?r=gii/default/login HTTP/1.1" 302 -

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/index.php?r=gii HTTP/1.1" 302 -

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/index.php?r=gii/default/login HTTP/1.1" 200 2403

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/assets/4e9f0adc/css/screen.css HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/assets/4e9f0adc/css/print.css HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/assets/4e9f0adc/css/ie.css HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/assets/4e9f0adc/css/main.css HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/assets/4e9f0adc/js/fancybox/jquery.fancybox-1.3.1.css HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/assets/c4b0baf3/jquery.js HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/assets/4e9f0adc/js/tools.tooltip-1.1.3.min.js HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/assets/4e9f0adc/js/fancybox/jquery.fancybox-1.3.1.pack.js HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/assets/4e9f0adc/js/main.js HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/assets/4e9f0adc/images/logo.png HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/assets/4e9f0adc/js/fancybox/blank.gif HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/fancybox/fancy_loading.png HTTP/1.1" 404 234

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/fancybox/fancy_close.png HTTP/1.1" 404 232

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/fancybox/fancy_nav_right.png HTTP/1.1" 404 236

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/fancybox/fancy_nav_left.png HTTP/1.1" 404 235

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/fancybox/fancy_shadow_nw.png HTTP/1.1" 404 236

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/fancybox/fancy_shadow_w.png HTTP/1.1" 404 235

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/fancybox/fancy_shadow_sw.png HTTP/1.1" 404 236

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/fancybox/fancy_shadow_s.png HTTP/1.1" 404 235

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/fancybox/fancy_shadow_se.png HTTP/1.1" 404 236

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/fancybox/fancy_shadow_e.png HTTP/1.1" 404 235

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/fancybox/fancy_shadow_ne.png HTTP/1.1" 404 236

127.0.0.1 - - [03/Jun/2010:12:54:24 -0400] "GET /testdrive/fancybox/fancy_shadow_n.png HTTP/1.1" 404 235

127.0.0.1 - - [03/Jun/2010:12:55:31 -0400] "GET /testdrive/index.php?r=gii/default/login HTTP/1.1" 200 2403

127.0.0.1 - - [03/Jun/2010:12:55:31 -0400] "GET /testdrive/assets/4e9f0adc/css/screen.css HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:31 -0400] "GET /testdrive/assets/4e9f0adc/css/print.css HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:31 -0400] "GET /testdrive/assets/4e9f0adc/css/ie.css HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:31 -0400] "GET /testdrive/assets/4e9f0adc/css/main.css HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:31 -0400] "GET /testdrive/assets/c4b0baf3/jquery.js HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:31 -0400] "GET /testdrive/assets/4e9f0adc/js/fancybox/jquery.fancybox-1.3.1.css HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:31 -0400] "GET /testdrive/assets/4e9f0adc/js/tools.tooltip-1.1.3.min.js HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:31 -0400] "GET /testdrive/assets/4e9f0adc/js/fancybox/jquery.fancybox-1.3.1.pack.js HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:31 -0400] "GET /testdrive/assets/4e9f0adc/js/main.js HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:31 -0400] "GET /testdrive/assets/4e9f0adc/images/logo.png HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:32 -0400] "GET /testdrive/assets/4e9f0adc/js/fancybox/blank.gif HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:32 -0400] "GET /testdrive/fancybox/fancy_loading.png HTTP/1.1" 404 234

127.0.0.1 - - [03/Jun/2010:12:55:32 -0400] "GET /testdrive/fancybox/fancy_close.png HTTP/1.1" 404 232

127.0.0.1 - - [03/Jun/2010:12:55:32 -0400] "GET /testdrive/fancybox/fancy_nav_right.png HTTP/1.1" 404 236

127.0.0.1 - - [03/Jun/2010:12:55:32 -0400] "GET /testdrive/fancybox/fancy_nav_left.png HTTP/1.1" 404 235

127.0.0.1 - - [03/Jun/2010:12:55:32 -0400] "GET /testdrive/fancybox/fancy_shadow_nw.png HTTP/1.1" 404 236

127.0.0.1 - - [03/Jun/2010:12:55:32 -0400] "GET /testdrive/fancybox/fancy_shadow_w.png HTTP/1.1" 404 235

127.0.0.1 - - [03/Jun/2010:12:55:32 -0400] "GET /testdrive/fancybox/fancy_shadow_sw.png HTTP/1.1" 404 236

127.0.0.1 - - [03/Jun/2010:12:55:32 -0400] "GET /testdrive/fancybox/fancy_shadow_s.png HTTP/1.1" 404 235

127.0.0.1 - - [03/Jun/2010:12:55:32 -0400] "GET /testdrive/fancybox/fancy_shadow_se.png HTTP/1.1" 404 236

127.0.0.1 - - [03/Jun/2010:12:55:32 -0400] "GET /testdrive/fancybox/fancy_shadow_e.png HTTP/1.1" 404 235

127.0.0.1 - - [03/Jun/2010:12:55:32 -0400] "GET /testdrive/fancybox/fancy_shadow_ne.png HTTP/1.1" 404 236

127.0.0.1 - - [03/Jun/2010:12:55:32 -0400] "GET /testdrive/fancybox/fancy_shadow_n.png HTTP/1.1" 404 235

127.0.0.1 - - [03/Jun/2010:12:55:35 -0400] "POST /testdrive/index.php?r=gii/default/login HTTP/1.1" 302 -

127.0.0.1 - - [03/Jun/2010:12:55:35 -0400] "GET /testdrive/index.php?r=gii HTTP/1.1" 302 -

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/index.php?r=gii/default/login HTTP/1.1" 200 2403

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/assets/4e9f0adc/css/print.css HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/assets/4e9f0adc/css/screen.css HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/assets/4e9f0adc/css/ie.css HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/assets/4e9f0adc/js/fancybox/jquery.fancybox-1.3.1.css HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/assets/4e9f0adc/css/main.css HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/assets/c4b0baf3/jquery.js HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/assets/4e9f0adc/js/tools.tooltip-1.1.3.min.js HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/assets/4e9f0adc/js/fancybox/jquery.fancybox-1.3.1.pack.js HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/assets/4e9f0adc/js/main.js HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/assets/4e9f0adc/images/logo.png HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/assets/4e9f0adc/js/fancybox/blank.gif HTTP/1.1" 304 -

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/fancybox/fancy_loading.png HTTP/1.1" 404 234

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/fancybox/fancy_close.png HTTP/1.1" 404 232

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/fancybox/fancy_nav_right.png HTTP/1.1" 404 236

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/fancybox/fancy_nav_left.png HTTP/1.1" 404 235

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/fancybox/fancy_shadow_nw.png HTTP/1.1" 404 236

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/fancybox/fancy_shadow_w.png HTTP/1.1" 404 235

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/fancybox/fancy_shadow_sw.png HTTP/1.1" 404 236

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/fancybox/fancy_shadow_s.png HTTP/1.1" 404 235

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/fancybox/fancy_shadow_se.png HTTP/1.1" 404 236

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/fancybox/fancy_shadow_e.png HTTP/1.1" 404 235

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/fancybox/fancy_shadow_ne.png HTTP/1.1" 404 236

127.0.0.1 - - [03/Jun/2010:12:55:36 -0400] "GET /testdrive/fancybox/fancy_shadow_n.png HTTP/1.1" 404 235

Not sure why it’s trying to reference the /testdrive/fancybox/ because that doesn’t exist. I tried to actually copy the /fancybox/ directory at the document root as well, and it cleaned up the messages, but still no go.

The application.log under /protected/runtime/ didn’t have anything that looked useful. I didn’t change any of the debug/trace info in the index.php


// remove the following lines when in production mode

defined('YII_DEBUG') or define('YII_DEBUG',true);

defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);

And have the following levels in the main.php to enable logging (error, warning, debug, trace, info).

Here is what’s in application.log after I hit submit with the password:


2010/06/03 13:06:20 [trace] [system.CModule] Loading "log" application component

in C:\localwork\workspace_pprl\testdrive\index.php (12)

2010/06/03 13:06:20 [trace] [system.CModule] Loading "request" application component

in C:\localwork\workspace_pprl\testdrive\index.php (12)

2010/06/03 13:06:20 [trace] [system.CModule] Loading "urlManager" application component

in C:\localwork\workspace_pprl\testdrive\index.php (12)

2010/06/03 13:06:20 [trace] [system.base.CModule] Loading "gii" module

in C:\localwork\workspace_pprl\testdrive\index.php (12)

2010/06/03 13:06:20 [trace] [system.CModule] Loading "user" application component

in C:\localwork\workspace_pprl\yii\framework\gii\GiiModule.php (168)

in C:\localwork\workspace_pprl\testdrive\index.php (12)

2010/06/03 13:06:20 [trace] [system.CModule] Loading "session" application component

in C:\localwork\workspace_pprl\yii\framework\gii\GiiModule.php (168)

in C:\localwork\workspace_pprl\testdrive\index.php (12)

2010/06/03 13:06:20 [trace] [system.CModule] Loading "log" application component

in C:\localwork\workspace_pprl\testdrive\index.php (12)

2010/06/03 13:06:20 [trace] [system.CModule] Loading "request" application component

in C:\localwork\workspace_pprl\testdrive\index.php (12)

2010/06/03 13:06:20 [trace] [system.CModule] Loading "urlManager" application component

in C:\localwork\workspace_pprl\testdrive\index.php (12)

2010/06/03 13:06:20 [trace] [system.base.CModule] Loading "gii" module

in C:\localwork\workspace_pprl\testdrive\index.php (12)

2010/06/03 13:06:20 [trace] [system.CModule] Loading "user" application component

in C:\localwork\workspace_pprl\yii\framework\gii\GiiModule.php (168)

in C:\localwork\workspace_pprl\testdrive\index.php (12)

2010/06/03 13:06:20 [trace] [system.CModule] Loading "session" application component

in C:\localwork\workspace_pprl\yii\framework\gii\GiiModule.php (168)

in C:\localwork\workspace_pprl\testdrive\index.php (12)

2010/06/03 13:06:20 [trace] [system.CModule] Loading "log" application component

in C:\localwork\workspace_pprl\testdrive\index.php (12)

2010/06/03 13:06:20 [trace] [system.CModule] Loading "request" application component

in C:\localwork\workspace_pprl\testdrive\index.php (12)

2010/06/03 13:06:20 [trace] [system.CModule] Loading "urlManager" application component

in C:\localwork\workspace_pprl\testdrive\index.php (12)

2010/06/03 13:06:20 [trace] [system.base.CModule] Loading "gii" module

in C:\localwork\workspace_pprl\testdrive\index.php (12)

2010/06/03 13:06:20 [trace] [system.CModule] Loading "user" application component

in C:\localwork\workspace_pprl\yii\framework\gii\GiiModule.php (168)

in C:\localwork\workspace_pprl\testdrive\index.php (12)

2010/06/03 13:06:20 [trace] [system.CModule] Loading "session" application component

in C:\localwork\workspace_pprl\yii\framework\gii\GiiModule.php (168)

in C:\localwork\workspace_pprl\testdrive\index.php (12)

2010/06/03 13:06:20 [trace] [system.CModule] Loading "clientScript" application component

in C:\localwork\workspace_pprl\yii\framework\gii\views\layouts\main.php (2)

in C:\localwork\workspace_pprl\yii\framework\gii\views\layouts\column1.php (7)

in C:\localwork\workspace_pprl\yii\framework\gii\controllers\DefaultController.php (47)

2010/06/03 13:06:20 [trace] [system.CModule] Loading "assetManager" application component

in C:\localwork\workspace_pprl\yii\framework\gii\GiiModule.php (136)

in C:\localwork\workspace_pprl\yii\framework\gii\views\layouts\main.php (3)

in C:\localwork\workspace_pprl\yii\framework\gii\views\layouts\column1.php (7)



Sorry this is long winded.

Thanks again for your help.

I did some more testing and if I set the password to false, I can get in without any problems.


        'modules'=>array(

	       'gii'=>array(

	            'class'=>'system.gii.GiiModule',

	            'password'=>false,

	        ),

	    ),



Not sure why when I provide a password, I can’t get off the login page. I’ve been using ‘test’ as the password (tried a few others as well). It’s like it’s recognizing the password because if it put in the wrong password…then it give me the invalid password message.

It looks like it has to do something in the GIIModule.php beforeControllerAction(…) method. I did a trace on the $route variable and it’s default/login…which is correct. I assume we are always going to be a Guest?

Any thoughts? I’ll continue to research.

Found the problem…not sure why. But in the gii.models.LoginForm.php file there is a function called login(). That in turn calls a method called


Yii::app()->user->login($this->_identity);

If I pass in a numerical value greater than 0…it works! (see below)


Yii::app()->user->login($this->_identity,100);

Is this a bug? Can you explain to me why I need to do this and everyone else doesn’t…if it’s not a bug.

The CWebUser login(…) method has the following comments:


	 * @param integer number of seconds that the user can remain in logged-in status. Defaults to 0, meaning login till the user closes the browser.

	 * If greater than 0, cookie-based login will be used. In this case, {@link allowAutoLogin}

	 * must be set true, otherwise an exception will be thrown.



Any ideas?

Yii allows for cookie based login. Maybe you have stored some autoLogin cookie, when you did your first tests. Just remove the cookies for localhost from you browser and try again.

I think I found the problem, although I am still researching how to fix it.

It’s like the web server isn’t able to store sessions at all. I created a simple PHP page that starts a session, stores a variable (if it doesn’t exist or increments it if it does exist), then display it on the web page. Every time the page is hit, a new session is created.

The one good thing that is coming out of this is that I got hands on use of debugging PHP files in Eclipse PDT. It seems to work OK, although I had to have my workspace root as the document root in order to be able to modify and run them. Not sure if that is the best practice…but it worked for now.

Fixed it! :))

It was a setting within the php.ini file. I had a full directory path for the


session.save_path

variable instead of a relative path from the PHP root directory.

I originally had (tried it with the \ as file separators as well)


session.save_path = "c:/localwork/php/temp"

but then changed it to


session.save_path = "/temp"

and now the session works OK within the Apache/PHP server and the Gii application works as well.

Thank you Mike for all your help. If you have any recommendations or can point me to best practices for a development environment for PHP/Yii development…that would be great. I come from 13 years experience with Java/J2EE development with EAR/WAR packaging, etc. I see some things are pretty similar, but others are different.

Thanks again.

Thanks joseph, this worked for me as well. In my case, I am using WampServer 2 on Windows Vista. When I installed WampServer, I never installed it to the default directory (C:\wamp). However, session.save_path in PHP.ini was still set to C:\wamp\tmp which didn’t exist on my system at all. I changed it to the relative path as suggested and it works great now.

There is one basic rule to follow:

Do not change the defaults unless you know exactly what you are doing!

And by default: you don’t.

Wampserver installation routine needs to make this more clear.

It worked when I removed the firefox browser cookies for the domain.

Thanks for this great article. My problem was that WebMatrix’s default PHP_Session_Path was not writable by my computer user account. I never would have figured that out without your help!

mine is set to


session.save_path="/Applications/XAMPP/xamppfiles/temp/"

and permission is set to 777 for the temp/ folder. still no luck here :(