Re: PHP Sessions
| From: | Jasper Bryant-Greene | Date: | Sun, 11 Sep 2005 23:13:02 +0000 |
| Subject: | Re: PHP Sessions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-222148@lists.php.net to get a copy of this message | ||
Chris Wagner wrote:
i recently started using PHP's sessions. i am finding that the sessions seem to "expire" after 20 or 30 minutes -- or, at least the variables which i set, within $_SESSION, are getting cleared after this relatively short amount of time. before calling session_start(), i do a few initializations: ini_set('session.use_cookies', 1); ini_set('session.use_trans_sid', 0); ini_set('session.save_handler', 'files'); ini_set('session.serialize_handler', 'php'); ini_set('session.name', 'session-id'); i am not setting the 'session.cache_expire' INI variable, and even did a check to make sure it was not being modified, and i found that it contains the default value of 180 (minutes). furthermore, the *cookie* is not expiring. i've also checked 'session.cookie_lifetime', and it is 0 (zero, for "until browser is closed"). i've also checked the browser's cookie list, and the cookie is still around at the time that i lose my session variables. does anyone have any ideas as to why i may be losing my session variables so early?Check session.gc_lifetime or similar. That is the garbage collection routine that goes through and deletes any session data files (in /tmp or wherever your setup puts them) that are older than that config setting value. -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ If you find my advice useful, please consider donating to a poor student! You can choose whatever amount you think my advice was worth to you. http://tinyurl.com/7oa5s