Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7996811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:47:58+00:00 2026-06-04T14:47:58+00:00

Kohana 3.2 sessions are expiring too soon. My current config is: return array( ‘native’

  • 0

Kohana 3.2 sessions are expiring too soon. My current config is:

return array(
'native' => array(
    'name' => 'kohanasession',
    'lifetime' => 0,       
 ),
);

Using lifetime => 0 means that the session will end when the browser is closed. However, after 1 hour, the session expires.

I also tried to use a lifetime different (for example 36000 => 10 hours), but again, it failed.

If I use a tiny session life (e.g. 10 seconds) then the expiration works perfectly. As far as I checked, seems that if I want a session to have a lifetime longer than 1 hour, it will not work.

Finally, the relevant config we use for php.ini

session.save_handler = memcache
session.save_path="tcp://127.0.0.1:11211?persistent=1&weight=1&timeout=1&retry_interval=15"
session.cache_limiter = nocache
session.gc_probability = 0

I am really lost here. This should be simple to fix but I just cannot work it out.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T14:48:00+00:00Added an answer on June 4, 2026 at 2:48 pm

    The lifetime => 0 parameter is likely only affecting the session cookie’s lifetime.

    What’s probably happening is that, while the cookie is working fine, you’re throwing away the users’ session data on the server side. PHP has session garbage collection that’s a little odd by default: it marks sessions as expired after 24 minutes of idle time, and has a 1% chance on each request to clean up all the expired sessions.

    You can increase the PHP ini setting session.gc_maxlifetime, or you could set session.gc_probability to zero to disable automatic session garbage collection entirely.

    Of course, there’s also the possibility that your memcached server is configured to throw away the data after some time period.

    Update: For the average session handler, setting session.gc_probability to zero would be the way to go to disable the automatic cleanup entirely. However, the memcache session handler actually already doesn’t do garbage collection (its gc callback does nothing). So, changing either of session.gc_probability or session.gc_divisor is pointless with that save handler.

    Instead, the memcache save handler automatically sets an expiration when saving the session data to the memcached server (a la the expire param to Memcache::set). The handler reads the expiration time to use from the session.gc_maxlifetime setting. So, that’s the only GC setting that really matters when you’re using the memcache session save handler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Kohana V3 is it possible to return result set as an array() or
I've noticed in Kohana 3 these error messages provided by default. return array( 'not_empty'
I have hard time with kohana sessions, i would like to store my sessions
What is the best way to get the current visitors session id in Kohana
In Kohana/CodeIgniter, I can have a URL in this form: http://www.name.tld/controller_name/method_name/parameter_1/parameter_2/parameter_3 ... And then
I am using the database session driver in Kohana v2. To make sessions persistent,
In Kohana 3 bootstrap.php one can define base_url : Kohana::init(array( 'base_url' => '/foo/', ));
I'am using kohana 2.3 and i have a trouble with config/routes.php. I am redirecting
Reading Kohana's documentation, I found out that the main difference in 3.0 version is
In Kohana 3, how can I override/extend a module class? E.g. I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.