Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 5th, 2004, 01:30 AM
Authorized User
 
Join Date: Feb 2004
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to knight
Default unset session at specified time

can i unset session to given time i want to unset session after 20 minutes after login and user autometically logof how can it possible pls tell me
thanks


 
Old March 5th, 2004, 01:43 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Use the session.gc_maxlifetime and session.gc_probability configuration directives in php.ini.

session.gc_maxlifetime accepts a value in seconds, its default is 24 minutes or 1440 seconds. session.gc_probability determines how likely the system is to preform garbage collection (delete outdated sessions) on every request, its default value is 1%. So to ensure that users are booted after 20 minutes of idle time up garbage collection probability. I use a 75% probability, but for other reasons.. I use it to get a more accurate count of how many users are on my site at any given time.

These directives are setable at any level, so you could use the ini_set() function, edit them in php.ini itself, or if you are using apache, edit the directives using .htaccess or httpd.conf.

Have a look at:
http://www.php.net/ini_set

hth,
: )
Rich

:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
 
Old March 10th, 2004, 12:41 AM
Authorized User
 
Join Date: Feb 2004
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to knight
Default

i use IIS i have changed maxlifetime but nothing did happened
pls i need some detail about that topic


 
Old March 10th, 2004, 05:13 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

I'm not sure what to suggest. Does IIs require a restart after altering ini values? Try restarting the server. You also have to increase garbage collection probability, if you don't then old sessions can (possibly) be revived.. even after their expiration time, provided the browser window hasn't been closed.

: )
Rich

:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
 
Old March 11th, 2004, 08:17 AM
Authorized User
 
Join Date: Feb 2004
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to knight
Default

i have made changes in php.ini and restarted IIS but the result is
same can u give some code about this issue

 
Old March 17th, 2004, 09:24 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have you verified that your new settings took effect? You can verify PHP's configuration at run-time using phpinfo:

<?php phpinfo(); ?>


If you can't get PHP to work using built-in sessions, you might want to write your own custom session handlers to make sure you're not allowing expired sessions to exist.

There's a good (albeit really old) article about this at www.phpbuilder.com.


Take care,

Nik
http://www.bigaction.org/





Similar Threads
Thread Thread Starter Forum Replies Last Post
session time out info nasirmunir PHP How-To 1 August 22nd, 2008 03:07 PM
session time out problem jaya929 ASP.NET 2.0 Professional 2 July 9th, 2008 02:15 AM
session time out lily611 General .NET 10 August 9th, 2004 08:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.