Re: Sessions, and timeout

From: Date: Fri, 09 Mar 2001 00:51:32 +0000
Subject: Re: Sessions, and timeout
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-43099@lists.php.net to get a copy of this message
It looks it would not cause too short expiration of session. (Expire is not set for cookie. This is not what you want probably, but this should not cause expiration of cookie within 10 or 20 min. You changes session.cache_expire, but set Expire: and no cache headers. I think you don't need to do both. It probably written for in case you want browsers to cache document, though.) These are what I'm look for next. Assuming you lost session data, but not session id. What is your session handler? file/mm/user? If user, is your gc function working as it should? Global value of session.gc_maxlifetime and others are set to low number in previous mail, change this to see if it fixes. [I forgot when garbage collection is performed, but if gc is done before/after session_read(), changes made by ini_set() - gc_maxlifetime - will not make any difference. If gc is done before/after session_write(), should work as expected] Do you have any code that uses session w/o changing gc_maxlifetime settings? [Change made by ini_set()/ini_alter() is local, would not change other connection's setting] If you lost session id stored in cookie, but session data exists on server. I have no idea what's wrong or what you need to look for. By the way, following line is redundant as I mentioned at first. ini_alter("session.cache_expire", "172800"); This will not affect, since you have Expire: and no cache header. There is other issue with this line. i.e. 172800 minutes for document expiration is too long. From my php.ini ;session.cache_expire = 180 ; document expires after n minutes Hope this helps. Yasuo Ohgaki == original msg === > Then how about check the server's response headers that sent to client? You > can view headers using wget or like. PHP might be sending global ini > var(which is set to small number) to client for some reason. Ok, this is the header information I get. HTTP/1.1 200 OK Date: Thu, 08 Mar 2001 11:52:37 GMT Server: Apache/1.3.14 (Unix) (Red-Hat/Linux) mod_ssl/2.7.1 OpenSSL/0.9.5a PHP/4.0.4pl1 mod_perl/1.24 X-Powered-By: PHP/4.0.4pl1 Expires: Thu, 19 Nov 1981 08:52:00 GMT Last-Modified: Thu, 08 Mar 2001 11:52:37GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Set-Cookie: PHPSESSID=784c532834c6a36451f91c235ee44aa4; path=/ Connection: close Content-Type: text/html;charset=iso-8859-1 Code snippet from the script: ------------------ // Disable page chacing. Could this interfer with sessions?? : header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); // Turn on output buffering ob_start(); // start session handling session_start(); // settings for sessions ini_alter("session.gc_maxlifetime", "172800"); ini_alter("session.entropy_file","/dev/urandom"); ini_alter("session.entropy_length", "512"); ini_alter("session.cache_expire", "172800"); // set the session variable (inside a class): session_register( "eZSession" ); $GLOBALS["eZSession"] =& $this->Hash; // fetches the session information: $hash = $GLOBALS["eZSession"]; // flush buffer ob_end_flush(); ----- For more code (full class listing) you can check out: http://doc.ez.no/ezsession.src.html#1 That should be straight forward right? I have no idea why it times out. I've tested quite alot of things now:) I've tested with Konqueror, Netscape and Opera. Every browser times out. Also with cookieless sessions. > Do you mean just like trans-sid? I think you cannot as far as I know. PHP > Programmers/HTML designer have to write code manually to add query string. > Anyone?? Yes, I would like that trans-sid. Like if I could have code like. php_auto_append_variable( "MyVar", "foo bar" ); ( Of course that makes no sense when I get the sessions up and running. ) Regards, -- Bård Farstad Systems developer ez.no | developer.ez.no | zez.org

« previous php.general (#43099) next »