|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55048 Garbage is Never Collected
Submitted: 2011-06-13 21:26 UTC Modified: 2011-06-13 22:42 UTC
From: kvonlaven at yahoo dot com Assigned:
Status: Closed Package: Session related
PHP Version: 5.2.6-1+lenny10 OS: CentOS 5.3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: kvonlaven at yahoo dot com
New email:
PHP Version: OS:


 [2011-06-13 21:26 UTC] kvonlaven at yahoo dot com
I'm using PHP version 5.2.6-1+lenny10.  I would upgrade or try using an SVN 
snapshot if I could, but I don't have administrator privileges on the server I'm 
using :-/.

Below is an excerpt from my php.ini file.

session.gc_probability = 1
session.gc_divisor = 1
session.gc_maxlifetime = 3600

I also have a call to session_save_path('Session Data') and 
ini_set('session.gc_maxlifetime', 3600) right before session_start() gets called.  
These three functions get called at the top of every page before any output is 
sent from the server.

Test script:
I executed the following script to verify that PHP has the appropriate privileges to delete temporary session files, and it deleted the file as expected.

  unlink('Session Data/name_of_arbitrary_session_file');

Expected result:
My understanding is that, using this configuration, the garbage collector should 
completely delete all temporary session files in the "Session Data" directory that 
are over an hour old every time anybody goes to any page on the site.

Actual result:
I have empty temporary session files in the "Session Data" folder that are several 
days old but have yet to be deleted.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-06-13 22:42 UTC] kvonlaven at yahoo dot com
-Status: Open +Status: Closed -PHP Version: Irrelevant +PHP Version: 5.2.6-1+lenny10
 [2011-06-13 22:42 UTC] kvonlaven at yahoo dot com
I just got it to work.  It turns out the settings in php.ini were being completely ignored and 
overwritten with the following values:

session.gc_probability = 0
session.gc_divisor = 100
session.gc_maxlifetime = 1440

Understandbly this meant the garbage was never being collected.  This is a little surprising 
because I thought the default value of session.gc_probability was supposed to be 1.  In any case, 
the reason my php.ini settings were being ignored is that I didn't put quotes around the string I 
assigned to a different ini variable.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Nov 29 20:05:52 2022 UTC