Jump to content

Session timeout


Recommended Posts

I have php 5.0.3 installed on Windows Server 2003 SP1 running Apache and even though I have set the session timeout to 3600 seconds my users are getting timed out within a couple of minutes.

Please tell me how to fix this.

Link to comment
Share on other sites

Show exactly what setting you changed, where you changed it, what syntax you used and have you checked the actual runtime value using a phpinfo(); statement?

 

Also, what exactly are the symptoms? What are they doing and what is happening that tells you the session is not working?

Link to comment
Share on other sites

We changed session.gc_maxlifetime in the php.ini using session.gc_maxlifetime=3600 & restarted Apache & yes we checked phpinfo().

The user signs in and does one or two things from a menu and then might leave the system for a minute or two and when they come back to it by clicking on a menu item they are told to logon to effect that choice & I can only assume that they have been timed out by the system.

I have the same configuration working fine on my Windows XP machine as well as under Linux Ubuntu.

BTW My current setup also works on Windows Server 2003 SP2.

Link to comment
Share on other sites

The only way that the garbage collection setting could be causing this symptom after a short period of time would be if this was occurring 3600s/60minutes after the session was first created AND the file system was not updating the time on the file each time the file is updated. Since, this is unlikely (everyone would have heard about it), what is more likely to be happening is either the hostname or path is changing and the session cookie parameters are not setup to work outside of the hostname or path where the session was started.

 

I recommend comparing all the session settings between one of your systems where this works and the one where it does not. The two most likely candidates are session.cookie_path and session.cookie_domain.

 

It is also possible that if you are switching between relative URL's and absolute URL's and session.use_trans_sid is on that the session id is changing from using a cookie to using the parameter on the end of the URL and something like URL rewriting is preventing the session id from propagating between pages.

 

 

Link to comment
Share on other sites

Here is another possibility - output buffering is enabled in php.ini on the system(s) where this works and not on the system where it does not work AND either the code is outputting content before session_start() or a file(s) got saved in UTF-8 format and the BOM is being output to the browser.

 

There are a bunch of different conditions that could cause sessions to not work. You need to investigate similarities and differences between the servers where it does and does not work. You also need to pin down any repeatable conditions, such as does it occur going to one particular page...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.