Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zend Framework rememberMe() doesnt seem to remember me

My session seems to only be valid in the current window/tab. Also it seems to timeout quickly. Heres how I'm currently attempting to do it:

This is in my login controller:

$adapter = $this->getAuthAdapter($data);
$auth    = Zend_Auth::getInstance();
$result  = $auth->authenticate($adapter);

if (!$result->isValid()) {
    $this->view->err = "Invalid username or password.<br/>Please try again.";
    return $this->render('index'); // re-render the login form
}

Zend_Session::rememberMe(60*60*24*7*4);

And this is in my bootstrap:

Zend_Session::start();

I'm relatively new to some of this stuff, so bear with me! Any help would be greatly appreciated.

like image 623
Brian Avatar asked Oct 16 '09 01:10

Brian


2 Answers

Here's what was happening. This website was on a server sharing a sessions folder with another website on the server. Even though I increased session lifetime with ini_set, my sessions were still being deleted by the other application.

To solve this I simply set session.save_path to a new folder. Problem solved!

like image 103
Brian Avatar answered Nov 01 '22 10:11

Brian


I just want to add that you change the session.save_path in the .htaccess with the follow row to make it work. I saw the answer thought I changed it in the .ini, but it's in the .htaccess.

For example:

php_value session.save_path /home/kaos/data/sessions/
like image 2
jarnesjo Avatar answered Nov 01 '22 11:11

jarnesjo