Jump to content

PHP clean-up of old sessions


johnsmith153

Recommended Posts

Can someone explain the whole session clean up / max life of a session thing.

 

I have searched google/internet a lot - so please don't just post a link to php.net!!

 

I suppose I want to know how to control:

(1) when PHP automatically clears up individual set $_SESSION variables within a user's logged in occasion (ie like unsetting one session)

(2) when PHP logs you out automatically for inactivity and clears the entire session (ie like session_destroy)

 

I think the php.ini settings that cover this are:

session.gc_maxlifetime

session.cookie_lifetime

 

Is there a known problem for shared servers against dedicated - where you don't have control on a shared of something? (I heard something about this)

 

How is the best way to set all this up so I can control the 2 things mentioned?

 

(I am sure in the past I have ignored this because it doesn't work - but that could be the shared server problem)

Link to comment
https://forums.phpfreaks.com/topic/146142-php-clean-up-of-old-sessions/
Share on other sites

Shared would effect your permissions. I do not know if they allow htaccess, but you can try setting them there. I would also change the session save folder to be located inside your portion of the host so no one can hi-jack sessions easily.

 

Again I do not know how much your host allows, but yea. You can always email them and ask.

At the moment it is shared, but I am looking to move to something else in next few days - could be dedicated/VPS/cloud - decision could depend on this + other things. There is a good budget for new server.

 

Thanks for replying.

 

 

I like the VPS route. It's your own server, maybe slow(??) but won't cost as much as dedicated server.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.