Problem Running New Yii Webapp

I’m having some problems running a new website created with yiic.

I was following the tutorial to create a new webapp, however when I run localhost/demo/index.php I just got the header "My Web Application", nothing else.

I searched the php files from the website to try to check the problem and I found the problem in the file demo\protected\views\layouts\main.php. If I remove the reference to Yii::app()->user->isGuest and Yii::app()->user->name of the menubar the site works properly.

Can anyone explain me why this is not working?

I’m running yii on Windows 8 with IIS 8 and PHP 5.5.4.

Additionally, when I try to use gii tool, through localhost/demo/index.php?r=gii I get a blank page :(, and I have already uncommented the gii lines in demo\protected\config\mainh.php.

Can anyone help me?

First of all, check your config file (config - components - user).

Next, try to use DB sessions (config - components):


‘session’ => array(

    ‘class’ => ‘system.web.CDbHttpSession’,

    ‘connectionID’ => ‘db’,

),

If you get a blank page you probably get a really fatal PHP error that couldn’t be catched by Yii. Check your http server logs, a helpful message should be there.

If you get a Yii error page there is a complete error message along with a stack trace in the application log at protected/runtime/application.log.

In your development enviroment it’s useful to see that full message directly on the page and this requires enabling the debug mode by defining the YII_DEBUG constant to true (see index.php). This should be done via your http server configuration using enviromental variables.

Remember, never show too much error information on production servers, this could reveal sensitive information leading to an attack.

You user error indicacates you got something wrong in the WebUser class. An error message and your component configuration would be really helpful.

I don’t know why ORey suggested using db sessions. You can’t really solve a problem until you know what it is. Guessing is a waste of time IMHO.

I had exactly the same problem.

After very effort, I find the problem in session path!

َAt solution set session.save_path in php.ini with appropriate value. and Don’t forget write permission for that path.