Controlling sessions on a shared server
Posted: Thu Sep 01, 2011 4:07 pm
Hello,
Hoping someone might have some insight into this hopefully easy-to-answer question. I am relatively new to PHP, but come from a programming background.
I am running a website hosted on a 1and1(.com) shared server, and I find that session data sometimes persists for hours and hours, but other times is lost within minutes of creating it. This may pose a problem for my customers who will log into their accounts, because there is no certainty about how long their session will remain active. If their session dies while they are filling out a form, they may be directed back to the login page after they hit Submit, which is a bit of an inconvenience. They should only have to log in once, not several times.
Is this happening because the shared server has some kind of global session garbage collector that runs at intervals (random ones, as far as I'm concerned), dumping all active sessions? And if so, is there any way to set a config flag that says please don't kill mine? Or, is it a client-side (browser) issue, or coding practices.
If this can only be resolved by moving to a dedicated server, I may do so.
Thanks
Hoping someone might have some insight into this hopefully easy-to-answer question. I am relatively new to PHP, but come from a programming background.
I am running a website hosted on a 1and1(.com) shared server, and I find that session data sometimes persists for hours and hours, but other times is lost within minutes of creating it. This may pose a problem for my customers who will log into their accounts, because there is no certainty about how long their session will remain active. If their session dies while they are filling out a form, they may be directed back to the login page after they hit Submit, which is a bit of an inconvenience. They should only have to log in once, not several times.
Is this happening because the shared server has some kind of global session garbage collector that runs at intervals (random ones, as far as I'm concerned), dumping all active sessions? And if so, is there any way to set a config flag that says please don't kill mine? Or, is it a client-side (browser) issue, or coding practices.
If this can only be resolved by moving to a dedicated server, I may do so.
Thanks