Yii Application Keeps Logging Out

Hey there,

I’m facing a very annoying issue here. I’m using the yii-app extension as a template for my web application. On a localhost for development, everything worked fine. After deployment however, an authenticated user only stays signed in for a few seconds, or after a few clicks around the user is logged out automatically.

Any ideas what might be the reason for this?


I advise to better debug the situation:

  • [size=2]use developer toolbar/firebug to check for PHP session cookie[/size]
  • [size=2]check server side php log files[/size]
  • [size=2]check yii application log files[/size]

an idea:

  • php configuration on server side dictates this minimal session lifetime?

I found what was causing the problem. Apparently, on the main domain I was doing the following:

if (isset($_SERVER['HTTP_COOKIE'])) {

    $cookies = explode(';', $_SERVER['HTTP_COOKIE']);

    foreach ($cookies as $cookie) {

        $parts = explode('=', $cookie);

        $name = trim($parts[0]);

        setcookie($name, '', time() - 1000);

        setcookie($name, '', time() - 1000, '/');



This resulted in the resetting of cookies on the Yii application I have installed on a sub folder of this domain.

Is there a way to keep that yet protect my sub yii application from it?

Thanks a lot for your help