//flex table opened by JP

Click to See Complete Forum and Search --> : PHP Session problems


quantass
08-07-2005, 01:54 PM
We're using PHP pages at work with all the default settings in place. What I've noticed is if users dont contact the server in X number of minutes, the session will expire and the user must relogin. Its very annoying. A special javascript function continuously contacts the server to try to help prevent this. The user's PHPSESSID cookie is set to expire only when the browser is killed. I figure the problem is with: session.gc_maxlifetime, a PHP environment variable set for 1440 secs (24 mins). I figure if the user hasnt contacted the server and refreshed the modified time of the respective session data file, this garbage collector will see that >=24mins has passed since last refreshed and will destroy the session data file.

Unfortunately I dont see this happening ever. My test PC at home seems setup the way the work's intranet is. I even have the exact same PHP files. I can login and leave the browser window up for hours and NEVER get automatically logged out howevere at work they are logged out automatically. Its as if the garbage collector at work is working and my home pc it is not.

Im using WIndows XP Pro IIS5, and the work, Windows 2003 Server IIS6. We're both using NTFS though i beleive i turned off my Last Access time for all files on my system to help with performance. I read that PHP resorts to using Last Modified time in such a case?

To recap my question is why does loggin in at work onto a PHP page which makes use of session cookies autpmatically logout after X minutes? I suspect the problem is with the behind the scenes PHP variable expiring (hasnt been refreshed in so many minutes) as opposed to the user's PHPSESSID cookie which doesnt have an expiration time but is destroyed only when the browser is shutdown (in my case the browser window remains open forever).

I've tried setting: ini_set('session.gc_maxlifetime', 60); in hopes of seeing the session garbage collector kick in every 1 minute to kill files but nothing happens. Perhaps setting this to >1440 at work will actually make a difference in session timeouts? Or does this environ variable have ANYTHING to do with file Session data variable expirations?

Thanks