state not saved on cookie

After extensive use I noticed that a user state is NOT saved with the cookie.

The scenario is simple

I have:

'allowAutoLogin' => true

'autoRenewCookie' => false,

'authTimeout' => 8*3600,

and indeed I am logged in for 8 hours. Even if I close the web browser and reopen it I am still logged in and after the period of the eight hours I am logged out automatically and I must re-login

All the above is expected behavior.

I also have a user state

Yii::app()->user->setState('island_id', $island_id);

Well this user state is lost after a relatively small period of time. I think about half-hour to an hour.

Why is this happening?

Notice that I have changed defaults of php.ini to these:

max_execution_time = 0

max_input_time = -1

Unfortunately I am using PHPExcel and there are scripts running for 15minutes or more, that’s why I am using these values on execution and input_time (don’t panic, this is only for development!)

State is saved in the session, not in a cookie.

If you want to save that state in a cookie, you need to use a CHttpCookie:

…and to continue jacmoe’s answer, your session probably times out after 24 minutes (php default setting 1440 sec) So, for development, simply extend the session timeout (php.ini) and your state should be saved.

That will still not save the state persistently - in a cookie.

As soon as the browser is closed, the session is terminated and all state is lost.

Use a cookie, or the new HTML5 local storage.

Thank you both for the answers.

@jacmoe: My idea is since there are not so many wikis maybe you could link the best of them with the class reference section. This way you could avoid a lot of future questions in the forum. The vice versa namely the links from wikis to class reference is already done from the authors of most wikis :)

I have one more questions for you if you spear the time. Since this configuration of php.ini, especially if you need multiple ones, or if you use different platforms (linux, windows, etc.) is troublesome I was wondering… if you use the "ini_set" function inside index.php so is always executed could you set the values for all configuration? Would be the same as if you have edited the php.ini (or using additional .ini files) ?

It is because you have to reset apache server for php.ini configuration to work. So is it more easily done from "ini_set" and being not problematic?