Reply to Re: PHP zombie sessions

Your name:

Reply:


Posted by Bernhard Jaud on 09/24/06 17:34

ctclibby schrieb in etwa dies, Am 24.09.2006 18:58:
> Hi All
Hi!
>
> Can I run a cron job and delete these? Or does PHP also store stuff in
> another location and could cause me grief down the road?
>
> Thanks in advance!
>
> todh
>
On my Debian-Server there is per default a cronjob that looks every 30
minutes for old sessions.

Cronjob:

09,39 * * * * root [ -d /var/lib/php4 ] && find /var/lib/php4/
-type f -cmin +$(/usr/lib/php4/maxlifetime) -print0 | xargs -r -0 rm

/usr/lib/php4/maxlifetime:

#!/bin/sh -e

max=1440

for ini in /etc/php4/*/php.ini; do
cur=$(sed -n -e
's/^[[:space:]]*session.gc_maxlifetime[[:space:]]*=[[:space:]]*\([0-9]\+\).*$/\1/p'
$ini 2>/dev/null
[ -z "$cur" ] && cur=0
[ "$cur" -gt "$max" ] && max=$cur
done

echo $(($max/60))

exit 0

HTH

--
Some humans would do anything to see if it is possible to do it.
If you would place a lager switch in some cave somewhere,
saying "END-OF-THE-WORLD-SWITCH!! DO NOT TOUCH!!!",
the paint wouldnt have time to dry.

-Terry Pratchett

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация