tags:

views:

153

answers:

4

Hi folks,

I'm seeing a strange situation, that I'm trying to figure out if it's a PHP issue, file issue, or normal operation. I have some users complaining about very fast timeouts on our site (session expires?), and checking the php tmp directory, I see things like this:

-rw------- 1 www-data www-data  377 2009-01-15 22:46 sess_fc789ce04a3d54ce929a401cd33ea868
-rw------- 1 www-data www-data 1167 2009-01-15 23:21 sess_fcb67b1f44a3669d8ffee69d5fa9a2e8
-rw------- 1 www-data www-data    0 2009-01-15 23:22 sess_fe0ab79c78c612d71ecca575753afdc4
-rw------- 1 www-data www-data    0 2009-01-15 23:07 sess_fedd46db2b023215cb060d67a01d3382
-rw------- 1 www-data www-data    0 2009-01-15 23:21 sess_feec900e144c011303a9f06eb428574e
-rw------- 1 www-data www-data    0 2009-01-15 23:00 sess_ffb2ed75ca311d08e41ec69c7d708d08
-rw------- 1 www-data www-data 1142 2009-01-15 22:49 sess_ffc2c882af3b3ad39b844dc5a530dc44
-rw------- 1 www-data www-data    0 2009-01-15 22:51 sess_fffbd6f7734ce3b4ef9d8009a324a459

Is this normal behavior?

TIA Mike

A: 

I'm not sure what you mean, exactly, but you could try putting:

<?php set_time_limit(100); ?>

at the top of every page. Maybe? Sorry =/

John
Answer below (forgot that code gets stripped)
John
A: 
<?php set_time_limit(100); ?>
John
A: 

OK, sorry I wasn't clear: In my session directory, I have 221 session files, 163 of which are 0 length. Is this normal, or do I have a session saving issue?

Mike Crowe
+1  A: 

Two possibilities spring to mind, one is that your out of disk space in a shared hosting environment, if this is not the case then your website may be sharing its session directory with other websites that have a short timeout on their sessions.

The gc_maxlifetime setting defaults to 1440 seconds, but if you share the same session dir with another website that has a lower setting than this then it will prematurely erase your sessions, this from the php manual:

Note: If different scripts have different values of session.gc_maxlifetime but share the same place for storing the session data then the script with the minimum value will be cleaning the data. In this case, use this directive together with session.save_path.

so i recommend changing your session save path to a different directory that the web server will have write permissions on.

Luke P M

related questions