简体   繁体   中英

Zend Framework - Zend_Session strange behavior

I'm just learning Zend Framework following it's official documentation at the website.

But I'm stucked with a strange behavior of Zend_Session: when user is authenticated, surfing the application pages - everything is ok but if he refresh the browser page quickly (pressing F5 or button in the toolbar) or even if some AJAX php file (that uses session) is requested multiple times, - the session suddenly expires (user is unauthenticated, however cookies expire dates are the same).

Though, I'm not using ACL and MVC structure in my application.

So it works and it is very simple but fails when page is refreshed quickly. Also I don't know why but a separate cookie file is created in /home/user/sessions/ for each page user has visited.

There is a similiar question here zend session expires when refreshed many times but the solution provided doesn't help me :(

In you config, you should set up something like this:

;; ========================= Session ===========================================
resources.session.save_path = APPLICATION_PATH "/../data/session"
resources.session.name = "SESSION"
resources.session.gc_maxlifetime =  5184000
resources.session.gc_probability = 1
resources.session.gc_divisor = 1000
resources.session.remember_me_seconds = 5184000
resources.session.cookie_lifetime = 5184000

That should do it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM