Hi folks,

I am having a problem with the lifetime of sessions:

In my htaccess file, I set session.cookie_lifetime to 86400 (24 hours), but the sessions seem to expire after approx. 60 minutes.

Thing is, they DO 'live' for a while, but not for the time that I set.

Any advice?

Thanks,

Jonathan

    It would be helpful if you showed exactly how you set said cookie. Most problems with cookie lifetimes seem to come either because the lifetime is set with quotes around it => lifetime is for this session or because of discrepancies between the browser and server's clocks. This latter is relatively easy to check. Just go running to netscape and look under Edit/Preferences/Privacy and Security/Cookies and then click on the button to view the cookies to find yours.

    Csaba Gabor

      Let me explain what I'm trying to do...
      I'm trying to create a form which will write to a file and then 'remember' the entries (as the 'value' property of the text field) for the next time the user comes back to the form.

      I did not use cookies directly, but rather a session that registers all the user's initial entries.

      In the php.ini file I set
      php_value session.cookie_lifetime 86400

      Now, this works. The initial entries are called and present when the form is visited after this initial input. BUT... only for approx. 60 minutes... (The session ID changes also, of course, after that time)

      If it didn't work at all I'd say "OK, something with the coding is wrong" But it works... So what happens after 60 minutes?

        What's your server software? If you use IIS, go to the properties for your web, to the home direcotry tab, then to configuration, then application options: you can set your session timeout here (note this is IIS 5. 4 is slightly different).

        I don't believe you need it for apache, as it is handled by the directive you gave it in php.ini... Anyone else confirm/deny this?

        That's all I can think of...

        J.

          6 years later

          hello my friend, i had the same question, just go to php.ini and replace the following piece of code :

          session.cookie_lifetime = 0

          with :

          session.cookie_lifetime = "3600" // 1 hour

          Then restart your apache server to take effect!!!

          In my case it has worked, test it and tell me

            Write a Reply...