会话文件未清理 [英] Session Files Not Getting Cleaned Up
问题描述
可能重复:
清理php会话文件
Possible Duplicate:
cleanup php session files
即使会话过期后,许多会话文件似乎仍在我的会话文件夹(/home/mysite.com/sessions
)中建立.我需要手动清除这些内容吗?
A lot of session files seem to be building up in my sessions folder (/home/mysite.com/sessions
), even after the session expires. Do I need to manually clear these out?
我打算写一份cron作业,但是我无法确定哪个会话文件处于活动状态,并且我不想仅仅杀死它们.
I was going to write a cron job, but I can't tell which session files are active, and I don't want to just kill them all.
推荐答案
Yes, you need to manually clean them up because you've setup your own session save path. You can check the age of a file and delete if it's older than x days/minutes whatever:
cd /path/to/sessions; find -cmin +24 | xargs rm
取自php.ini
的注释部分:
; NOTE: If you are using the subdirectory option for storing session files
; (see session.save_path above), then garbage collection does *not*
; happen automatically. You will need to do your own garbage
; collection through a shell script, cron entry, or some other method.
; For example, the following script would is the equivalent of
; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
; cd /path/to/sessions; find -cmin +24 | xargs rm
也请参阅以下相关/重复问题: 清理php会话文件
See as well this related/duplicate question: cleanup php session files
单个"命令:
find /path/to/session -name sess_* -cmin +24 -exec rm {} \;
这篇关于会话文件未清理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!