Welcome Guest, Not a member yet? Register   Sign In
Session Files Question
#1

My sessions create a new file OK.

How every if there are any old session files Question do they get deleted automatic at certain time.

Because I do not want to get my session cache folder full.

Thank you.
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply
#2

Do not worry. It will not get full. The "garbage" (old session files) will automatically be removed periodically.
How often this happens depends on the PHP.ini settings session.gc_probability and session.gc_divisor.
Read about these settings here. The default values are usually just fine.

The garbage collector is triggered when the session library is loaded.
Reply
#3

(08-31-2016, 07:43 AM)dave friend Wrote: Do not worry. It will not get full. The "garbage" (old session files) will automatically be removed periodically.
How often this happens depends on the PHP.ini settings session.gc_probability and session.gc_divisor.
Read about these settings here. The default values are usually just fine.

The garbage collector is triggered when the session library is loaded.

What about if I use database instead does it delete old sessions from database in time like files garbage?
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply
#4

Yes, the same garbage collector should kick in to remove old session data from the database.

But be aware if you setup a VPS on your own instead of using services from a webhosting company. Some linux distro's, like Debian for example, ship with the default settingConfusedession.gc_probability = 0. Wich mean that php will not run the garbage collection stuf. Debian's philosophy here comes from a security point of view that old sessions should be destroyed with a cronjob instead of by a php instance. Just some side info to keep in the back of your mind.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB