Zend session expiration problem

Hello again,
im having troubles with session, i need my application to remember me forever (month ..), but it doesnt :(

class CmsController extends Zend_Controller_Action
{
public function init()
{
$this->session = new Zend_Session_Namespace('CMS7');
$this->session->setExpirationHops(9999999);
$this->session->setExpirationSeconds($this->config->sessionAlive); // sessionAlive = 1440000

but im logged out in 15 minutes ...

Any ideas please ?
Mike

Zend_Session_Namespace / Zend_Session options

Hello,

Zend_Session_Namespace has own options, specific to the namespace. If you want to set global session options, which would be applied for all namespaces, use Zend_Session::setOptions() or pass options to Zend_Session::start().

Sincerely,
Alex

Still problem

Hello,
yes im doing it so, but there is a problem, im using dojo panes, and i download more panes by href="" parametr at the "same" time, so there are more request in same second, than the session in one (from 2 ) window is not initialized correctly and i get a login page ...

When i do just :
$this->session = new Zend_Session_Namespace('CMS7');
if works fine, but only for 15 minutes

not :
'sessionAlive' => 1440000, /* seconds */ //40h
'session' => array(
'use_cookies' => 'on',
'remember_me_seconds' => 86400000
)

Zend_Session::start();
Zend_Session::setOptions($config->session->toArray());
Zend_Session::rememberMe($config->sessionAlive);
$this->session = new Zend_Session_Namespace('CMS7');

this loggme of in tabs, but it remember me
so as only this

$this->session = new Zend_Session_Namespace('CMS7');
Zend_Session::rememberMe(8000000);

it seem slike the rememberMe function is doing something wrong :(

Can i fix it somehow please ?
Mike

The quick hint it to reorder

The quick hint it to reorder Zend_Session::start(); and Zend_Session::setOptions($config->session->toArray());. Maybe this is the problem?

Another hint - you can check the sent cookies in Web Developer FireFox extension.

Sincerely,
Alex

still not workin

Thanks, but its still not working, aren't there some security reasons to delete session when too much request are posted at the same time ?
Can i prevent it somehow ?

Mike

>delete session when too

>delete session when too much request are posted at the same time ?
I never heard of such sort of things.

>Can i prevent it somehow ?
What do you want to prevent? Big number of requests per second?

problems

So i really dont know why it is not working,
$this->session = new Zend_Session_Namespace('CMS7');
works for 15 minutes

$this->session = new Zend_Session_Namespace('CMS7');
Zend_Session::rememberMe(100000000);
doesnt work, logs me of in windows

Yes that would be userfull, can i prevent it somehow ? i thought there was some parametr in session config to do this, but there is no anymore .. ?

Thankx

Solution

Hello,

The following code works just fine:

set_include_path('.;' . dirname(__FILE__) . '\\ZendFramework.1.0\\library');
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();
$time = 60*60*24*365; /*= 31536000 */
Zend_Session::setOptions(array('cookie_lifetime' => $time, 'gc_maxlifetime' => $time));
Zend_Session::start();

It sends the following cookie:
Set-Cookie: PHPSESSID=6b3b9ae57688dde0614e15ab49e7114c; expires=Sat, 04 Oct 2008 18:34:16 GMT; path=/

So, "expires" is set correctly (in one year).

As for bug number of requests: I do not know any "official" solution for this. You need to implement it manually or use some third-part solution. For example, a solution may check the time between last ten requests and, if it is less then 1 second, redirect users to some static html page that does not create session.

; - (

Helo,
it helped a little, im not logged in immediatelly, but it remember me still only for 15 minutes cca :( Really dont know what's hapenning :(

$time = 60*60*24*365; /*= 31536000 */
Zend_Session::setOptions(array('cookie_lifetime' => $time, 'gc_maxlifetime' => $time));
Zend_Session::start();
$this->session = new Zend_Session_Namespace('CMS7');

Ok ill try to make something like that, thankx

Sincerely,
Mike

Or can this depend on server

Or can this depend on server configuration ?
Can something be wrong ?
Thank you

Try to check how the session

Try to check how the session cookie is set, php.ini, try to set your own session variable, check you code on different computer (send me code file by email so I can run it) or in different environment on the same PC.

Sincerely,
Alex

Cookie seems to be set ok,

Cookie seems to be set ok, and this is the only one ...
any mistake in it ? Path ?

Name PHPSESSID
Value a303c7d290be14aeacf34ca727173aab
Host xxx.xxxxxxxx.xx
Path /
Secure No
Expires Mon, 06 Oct 2008 09:33:19 GMT

But im still logged out in 20min
if this is right, ill send you acces to the system
Thanks for your patient
Mike