|
Joined: Jul 2006
Posts: 116 Likes: 4
Member
|
Member
Joined: Jul 2006
Posts: 116 Likes: 4 |
I just noticed that my sessions directory was full with hundred-thousands of session files . It was even not possible to clean the directory with rm *. Luckily midnight commander did the trick. You might want to add a function to delete the session files after the session timed out
Last edited by Rick; 11/09/2006 5:14 PM.
|
|
|
|
Joined: Jun 2006
Posts: 106
member
|
member
Joined: Jun 2006
Posts: 106 |
I don't have that many session files in my session folder? And all of mine are dated today so old ones here are going away.
Something odd to look into.
|
|
|
|
Joined: Jul 2006
Posts: 116 Likes: 4
Member
|
Member
Joined: Jul 2006
Posts: 116 Likes: 4 |
Interesting. If it helps the server is running the lastest PHP version (currently 5.2.0, 5.1.6 before) as FastCGI under LightTPDThe directory is still filling up with sessions: bouncer:/var/webs/philipp# cd sessions
bouncer:/var/webs/philipp/sessions# find . | wc -l
3605
bouncer:/var/webs/philipp/sessions#
|
|
|
|
Joined: Aug 2006
Posts: 1,649 Likes: 1
Pooh-Bah
|
Pooh-Bah
Joined: Aug 2006
Posts: 1,649 Likes: 1 |
All mine are from today, too -- in fact, only from the past 20 minutes or so...
GangsterBB.NET (Ver. 7.6.1.1) PHP Version 5.6.40 / MySQL 5.7.23-23 (was 5.6.41-84.1) / Apache 2.4.54 2007 Content Rulez Contest - Hon Mention UBB.classic 6.7.2 - RIP
|
|
|
|
Joined: Jun 2006
Posts: 16,301 Likes: 116
|
Joined: Jun 2006
Posts: 16,301 Likes: 116 |
Mine are also all created today, couple hundred of them...
i'm pretty sure they get purged automagically when the session no longer exists.
|
|
|
|
Joined: Jun 2006
Posts: 9,242 Likes: 1
Former Developer
|
Former Developer
Joined: Jun 2006
Posts: 9,242 Likes: 1 |
This is handled natively by PHP, at least it's supposed to be. There is a setting in php.ini that designates how stale they need to be before they are cleared. Not back at home yet, so I can't actually check on the exact setting.
|
|
|
|
Joined: Jul 2006
Posts: 116 Likes: 4
Member
|
Member
Joined: Jul 2006
Posts: 116 Likes: 4 |
Thanks, I found the problem. It is related to the Debian PHP5 package, which handle session garbage collection different than other Linux distributions. From the php.ini: ; This is disabled in the Debian packages, due to the strict permissions
; on /var/lib/php5. Instead of setting this here, see the cronjob at
; /etc/cron.d/php5, which uses the session.gc_maxlifetime setting below
;session.gc_probability = 0
session.gc_divisor = 100 I replaced: ;session.gc_probability = 0 with: session.gc_probability = 1 and the sessions gets now automatically cleared
|
|
|
|
Joined: Jun 2006
Posts: 16,301 Likes: 116
|
Joined: Jun 2006
Posts: 16,301 Likes: 116 |
If your host allows you to, you can set these in a .htaccess file when you don't have access to edit the php.ini (although I'm unsure as to what level of permissions you'd need to override this setting) .htaccess code: session.gc_probability 1 1
session.gc_divisor 1000 1000 To check if this actually works wiht the security level they allow you (I use AllowOverride ALL in my php.ini for my sites so i can override settings as needed) you'll need to open a phpinfo script to check. phpinfo.php:
|
|
|
1 members (Ruben),
1,277
guests, and
207
robots. |
Key:
Admin,
Global Mod,
Mod
|
|
|
|