peppy — 2012-02-15T23:15:15-05:00 — #1
I have a php site where members log in and post classified ads. A member is complaining that they are occasionally getting booted off in the middle of making a post. I'm not sure why this is happening.
Could it have something to do with my connection being: mysql_pconnect ?
Are too many people using the site for persistent connection to be used and members are being booted out?
shalini23 — 2012-02-15T23:55:08-05:00 — #2
I have also a problem that happen with u and I m so confused for this..I don't understand, what I m doing for this..
Have a nice day..
peppy — 2012-02-16T17:40:31-05:00 — #3
Anyone know what might be causing this?
wonshikee — 2012-02-16T18:08:36-05:00 — #4
Is the session data being stored in the database?
That would make sense then with persistent connection, but why is it using that in the first place?
peppy — 2012-02-16T18:23:57-05:00 — #5
As far as I know, the session data is not stored in the database, it must be on my shared hosting server or something.
I am using persistent connection because I am using Dreamhost. They have a system set up called "conqueries", where one connection is equal to 25 queries of resources. So I set up persistent connection to conserve resources. They said this rule isn't important now like it was years ago, but they are still recording it in their statistics...
So would changing "mysql_pconnect" to "mysql_connect" actually solve this issue and prevent people from randomly being logged out? Also, I am getting about 1000 visitors per day.
wonshikee — 2012-02-16T19:47:50-05:00 — #6
If the session data is not stored in the database, it should have nothing to do with persistent connections (in theory).
Things you want to check for are session cookie's lifetime, or a remote possibility could be if you still have register_globals on and somehow it's being overriden. Or it could just be a logical error in the code that's causing them to kill the session.
peppy — 2012-02-16T19:59:36-05:00 — #7
I noticed that I have an item inside my listing page with an iframe that opens up a php file. This file did not have "session_start();" in it. Could this alone cause the user to lose their session?
It rarely ever happens, the page is used a lot and I've never witnessed it myself, but maybe the user clicked in the iframe or something?
serverstorm — 2012-02-16T22:33:56-05:00 — #8
@peepy Issuing session_start() after a session is already started will simply trigger a warning. It is likely that the apache directives plus the server time and the user's browser time are causing the early boot.
These are the apache directives:
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
The session.gc_maxlifetime is in seconds. If the server time and the browser time were off by 9 minutes then a user would be logged in for only 1 minute before the auto disposal of the session happens, killing their logged in state.
You need to decide how you will control this. For example you could set an unlimited session time and then manually control deletion of the session when a user logs out, inactivity occurs for a xxx length of time or whatever criteria you want.
Hope this helps,