473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

PHP Sessions Timing Out.

Hello,

I am having problems with my PHP sessions timing out. I have a system
which requires the user to login. Once they login, it then stores their
username as a session variable and is checked in each page. If the
username is missing, then it makes the user log back in.

However, after 5 or 10 mins of not using the system, the user then
clicks on an option and it is prompting them to login.

At the moment this is only happening on certain computers. I generally
find that the Windows XP machines dont lose the variables easily, where
the Windows 2000 machines do.

Could this be a setting in the client or the server?

Any suggestions would help me as I've looked in the php.ini on the
server and at the IE client settings and nothing strikes me.

Thanks in Advance.
Dean

Apr 5 '06 #1
1 3812
"Dean Richardson" <ad*********@deanrichardson.com> writes:
I am having problems with my PHP sessions timing out. I have a system
which requires the user to login. Once they login, it then stores their
username as a session variable and is checked in each page. If the
username is missing, then it makes the user log back in.

However, after 5 or 10 mins of not using the system, the user then
clicks on an option and it is prompting them to login.

At the moment this is only happening on certain computers. I generally
find that the Windows XP machines dont lose the variables easily, where
the Windows 2000 machines do.

Could this be a setting in the client or the server?

Any suggestions would help me as I've looked in the php.ini on the
server and at the IE client settings and nothing strikes me.


I assume you know the session is tracked by a cookie,
and the cookie life is set by the server. I'm assuming you have
it set to zero in your php.ini (which means last as long as the
browser).

Sounds like they are expiring at random times and that
is probably a server setting, look at the session.gc_* stuff
below, especially maxlifetime. When that amount of time goes
by it is expired. If you have 'shared hosting' your provider
controls this value. They may have set a very low value to
keep from clogging the session directory with useless stuff.

That should give you a start. If that doesn't do it
you should be able to find the session cookie on most browsers
and actually see what the lifetime was set at.

---------------- PHP.INI
; Lifetime in seconds of cookie or, if 0, until browser is restarted.
session.cookie_lifetime = 0

; Define the probability that the 'garbage collection' process is started
; on every session initialization.
; The probability is calculated by using gc_probability/gc_divisor,
; e.g. 1/100 means there is a 1% chance that the GC process starts
; on each request.

session.gc_probability = 1
session.gc_divisor = 1000

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 10800

---------------------

Hope this helps.

John
__________________________________________________ _________________
John Murtari Software Workshop Inc.
jmurtari@following domain 315.635-1968(x-211) "TheBook.Com" (TM)
http://thebook.com/
Apr 6 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Ohaya | last post by:
Hi, I'm trying to understand a situation where ASP seems to be "blocking" of "queuing" requests. This is on a Win2K Advanced Server, with IIS5. I've seen some posts (e.g.,...
3
by: dw | last post by:
Hello, all. We're running ASP apps on a Windows 2003 Standard Edition box with 2.37 GB RAM, 731 MHz PIII processor, and hard disk space of 2.56 GB free on C: and 125 GB free on D:. We've noticed...
14
by: Rob Meade | last post by:
Hi all, Having created a secure login, and then create session variables to detect wether or not a user is logged in - I would now like to be able to off a log out page! :) I have found the...
2
by: Paul W | last post by:
Hi - I have a relatively simple asp.net app. If the browser session is left idle for a while (10+ minutes) when I next do something in the browser that should move me to another page (either in the...
6
by: Mad Scientist Jr | last post by:
My asp.net pages sessions are timing out after 20 minutes, and when I asked my Web host about it they said due to the nature of a shared hosting environment they cannot allow for sessions to keep...
15
by: Mark Rae | last post by:
Hi, I'm presently converting a v1.1 ASP.NET app to v2, and am encountering a strange problem. When running in Debug mode (i.e. hitting F5), all is well. However, when running without...
6
by: Andrew Chung | last post by:
Hi all, For an application that I'm working on, upon successful authentication, Session.Timeout is set to 60 minutes. This behaviour works as expected on my own machine. If I refresh a page...
2
by: wickedHangover | last post by:
ok, so I have a .net form using c#. I'm using a session variable to store some data while entering items in the form since each time you hit the page it initiates a new session which equals a row in...
4
by: Nebulus | last post by:
We've got a website that's designed in classic ASP. While it's a good product, the original design was badly done, and I've inherited a monster. At some point last week, users began calling in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.