SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2010
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Testing garbage collection

    I'd like to force my server to consider my session variables as garbage after 1 minute. This is just a test to try to learn what's really going on with the server and how it determines what garbage is. I have an issue with my application appearing to time out and I'm trying to replicate what I'm thinking the problem might be.

    I've set up the php.ini file with these values:
    session.gc_probability = 1
    session.gc_divisor = 1 (trying to make the probability 100%)
    session.gc_maxlifetime = 60

    Previously, I had the default values set, and the issue would always occur after 24 minutes (session.gc_maxlifetime = 1440). With these changes made to php.ini, I'm not able to replicate the issue for the shorter time span. It is even possible to do so by playing with the php.ini file in this way? Is there something more going on with the server than just these settings?

  2. #2
    SitePoint Enthusiast
    Join Date
    Dec 2011
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have done this correctly. But now remember that the session garbage collection is started when 'someone' visits your site. If you are the only one testing, like on your local PC, then your tests will not work as expected because you are deleting and then immediately resetting your own sessions.

    What you need to do is to at least use 2 different browsers. Login from one browsers, then after 2 minutes or so visit your page from a different browsers. Then reload the page from browsers you logged in with. That's the proper way to run your test.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •