Shell script to remove old PHP4 sessions in /tmp
| From: | Christopher Thompson | Date: | Sun, 04 Jun 2000 23:18:02 +0000 |
| Subject: | Shell script to remove old PHP4 sessions in /tmp | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1005@lists.php.net to get a copy of this message | ||
I wrote a very small shell script to remove session files that are over a
day old. This assumes PHP4 sessions in their default configuration, which
file based in /tmp. Modify as necessary. It could be run daily using cron.
#!/bin/sh
# phpexpiresessions: remove old PHP session files from /tmp
find /tmp -name "sess_*" \! \( -atime 1 \) -print -exec rm {} \;
This is obviously crude, so I hope that someone who knows more about PHP4
sessions will suggest a better way to deal with expired sessions. Is there
is a way within the PHP4 session support?
Also, has anyone done any performance comparisons between file and say
MySQL based sessions?