Justtechjobs.com Find a programming school near you






Online Campus Both


php4-beta | 199912

Re: [PHP4BETA] Session garbage collection From: Sascha Schumann (sascha <email protected>)
Date: 12/13/99

On Mon, Dec 13, 1999 at 01:40:08PM +0100, Hans Rakers wrote:
> Hi all,
>
> I'm implementing php4 session management in a huge website we're
> developing. Now i want to start a session for every visitor hitting our
> website, but i'm wondering about whether it is a smart thing.
>
> Php4 is configured to write session files to a directory on a EXT2 partition,
> and i don't know the limitations for this type of file system, but when there's
> lots of visitors in a small timespan this might get tricky. So my question is
> how often do old, unused registered sessions get purged? Do i really run into
> trouble in this situation? Or should i use a different type of filesystem for
> storing session files?

    ext2fs can be used to store session information. If you worry
    about having millions of directory entries, you can enable
    hashing, so that the session module distributes the files
    over multiple directories.
   
    The following steps have to be performed to store the data in
    /sessions and to enable a hash-depth of 2 directories.
    
    1.) Configure PHP:
    
        session.save_path = 2:/sessions
        session.save_handler = files

    2.) Create the directories:

        $ mkdir /sessions
        $ sh php-4.x/ext/session/mod_files.sh /sessions 2

    3.) Set up a cron job to expire old session files (if the
    hash-depth is > 0, this is currently not performed by the
    session module because of efficiency reasons). For example,
    to expire files older than 1 day every hour:

    23 * * * * find /sessions -ctime +1 -exec rm {} \;

-- 

Regards,

Sascha Schumann Consultant

-- PHP 4.0 Beta Mailing List <http://www.php.net/version4/> To unsubscribe, e-mail: php4beta-unsubscribe <email protected> For additional commands, e-mail: php4beta-help <email protected> To contact the list administrators, e-mail: php4beta-admin <email protected>