views:

60

answers:

2

Hi guys,

The session in my application often gets expired.

session_gc_maxlifetime is set to 24 minutes(default);

since my apps is a real time application that basically uses AJAX. Every second my ajax function calls a http request. As far as i know my session should not expire because it always called upon the ajax request.

It works for sometime and getting expired very soon sometimes(about 2-3 minutes of inactivity).

Can anyone help me out in solving this problem. Not only my website but the others website hosted in the same server encountered the same problem.

With Thanks and Regards, Trez

A: 

Can you reproduce this problem on a non-production server?

Have you got any scripts which clean out the sessions directory? Have you looked in the sessions directory to see how old the files are?

If you are not the only one with root access, I'd suspect someone else who is, try talking to them.

MarkR
what are possible scripts to use for cleaning the session directory? ALso what particular directory for the session i can go to?
Trez
+2  A: 

The session_gc_maxlifetime is basically useless when sessions share location with other hosted sites: PHP does not track which site owns which session file so the site with the shortest session_gc_maxlifetime is likely to remove session data from all sites.

I suggest you enable a directory for your site and set it with the session_save_path() function before calling session_start().

Álvaro G. Vicario
thanks for the suggestion...my system is working now.
Trez
So the question is answered?
Álvaro G. Vicario