문제

I developed my site on my local server and had no problem, I then put it on a live server and had no problem, I have since moved it to a VPS but I'm having a strange thing happen in that I can't login any more. The new server has newer software like PHP 5.5 (but my localhost also had that). I'm not really sure where to start with finding the problem.

my config looks like this:

'session' =>array(
        'savePath' => '../mySession',
        'sessionName' => 'my_session',
        'cookieParams' => array(
                 'secure' => true,
                ),
    ), 

I can see my sessions are being saved into the session folder. I am able to change the language of my site which uses a session too. So I'm not entirely sure it is a session problem, or what it is, hence my question.

Update

I looked into the action and this is standard Yii code

if($model->validate() && $model->login())
            echo 'hello';//$this->redirect(Yii::app()->user->returnUrl); 
    }

When I ran this, the page echoed out Hello and I could see I was logged in. When I went to click my profile, it then loaded the login page again and showed I was logged out. So It seems to be a session retention issue?

The only thing I can see that is strange is that In my local host I can see my_session and the yii_csrf session. But on my VPS I can see these two and also a PHPSESSION, so I'm wondering if that is causing the conflict, but I don't know.

도움이 되었습니까?

해결책

I think I've fixed this, despite setting the config file for the savePath I ran phpinfo() and it showed my local value as my session save path, but my master value was still the tmp directory.

다른 팁

You can try the following code and check if the session component is preloaded (in your configuration file). Maybe the session hasn't started. Finaly make sure your session folder is writeable.

 'session'=>array(
                    'timeout'=>3600,
                    'sessionName'=>'my_session',
                    'autoStart'=>true,
                    'class'=>'CHttpSession',
                    'cookieMode'=>'only',
                    'cookieParams' => array(
                        'secure' => true,
                    ),
                ),
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top