2

I have php session management in a Zend Framework 1.12 system. Everything works fine - sessions are created correctly, cookies are stored correctly, and the system works. But, periodically, the user gets booted. When I check, the session file is not gone, but it has been emptied. I don't want PHP to ever end the session on its own, I have programmatic ways of handling timeouts.

I thought it was a garbage collector issue, so I've set the following:

session.gc_maxlifetime = 28800
session.gc_divisor = 10
session.gc_probability = 0

But it continues to periodically happen. Is this garbage collector if the file is not removed, but emptied? How can I prevent this from happening?

yycroman
  • 7,511
  • 1
  • 19
  • 21
  • thanks Rasclatt: a helpful edit! – yycroman Aug 07 '16 at 05:26
  • try going through some configs from link that might give some help, https://framework.zend.com/manual/1.10/en/zend.session.global_session_management.html – Adil Abbasi Aug 10 '16 at 05:20
  • if you run in your code this is it echoing error? if(!session_regenerate_id(true)) { echo 'error'; } also check if after running session_regenerate_d(true) your old session is left maybe empty – Pawel Dubiel Aug 10 '16 at 16:35
  • Could be client-side if the browser is killing the cookie, or not storing it properly – rscarson Aug 10 '16 at 20:40
  • 3
    The garbage collector will delete the file session. Don't you have in your code something which write the sessions and where you can sometimes have an empty content ? – Sylwit Aug 11 '16 at 19:13
  • Have you checked http://stackoverflow.com/questions/5962671/prevent-session-expired-in-php-session-for-inactive-user ? – ka_lin Aug 16 '16 at 13:16
  • This should help. http://stackoverflow.com/questions/6643042/how-can-we-make-zend-session-storage-as-persistent-among-available-methods Saving sessions in DB is another way but be sure you are not exposed to session hijacking. https://framework.zend.com/manual/2.0/en/modules/zend.session.global-session-management.html – Gary Aug 17 '16 at 04:22

0 Answers0