Current location: Hot Scripts Forums » Programming Languages » PHP » can not kill session


can not kill session

Reply
  #1 (permalink)  
Old 02-18-08, 12:50 PM
zodehala zodehala is offline
Wannabe Coder
 
Join Date: Mar 2007
Posts: 191
Thanks: 0
Thanked 0 Times in 0 Posts
can not kill session

my php.ini settings

Code:
; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 5


; Document expires after n minutes.
session.cache_expire = 1
in spite of this my session does not die after even 2 minutes (in İE & Firefox)

session_read.php
PHP Code:

session_start();
if (
$_SESSION["name"]==''){
    echo 
'no session';
}else {
    echo  
session_id()."<br/>" 
    echo 
$_SESSION["host"]."<br/>" 
    echo 
$_SESSION["name"] ."<br/>" ;
    echo 
$_SESSION["zaman"]."<br/>" 
    echo 
$_SESSION['count']++;

session_write.php
PHP Code:

session_start();
$_SESSION["host"] = $_SERVER['REMOTE_ADDR'];
$_SESSION["name"] = "programmingtalk";
$_SESSION["zaman"] = date(' H:i:s d-m-Y');
$_SESSION['count'] = 0

why does not my session die automatically ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 03-04-08, 05:56 AM
sachink03's Avatar
sachink03 sachink03 is offline
Newbie Coder
 
Join Date: Feb 2008
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Smile

Hi,

By default php sessions are having cookies enabled and the time for cookie expiration is set to 0 i.e. it will last till the browser is closed.

So try to set the cookie expiration time (in seconds)
search for the following entry in the php.ini and set it accordingly.
Code:
; Lifetime in seconds of cookie or, if 0, until browser is restarted.
session.cookie_lifetime = 300
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 03-04-08, 08:31 AM
Jay6390's Avatar
Jay6390 Jay6390 is offline
Code Master
 
Join Date: Apr 2007
Location: United Kingdom
Posts: 1,330
Thanks: 0
Thanked 0 Times in 0 Posts
Hi Zodehala. Check this thread for more information on this problem / issue

Jay
__________________
Useful Tutorials
[ PHP Video-1-2-3 ] [ MySQL 1-2-3 ]
For any php function reference type

www.php.net/FunctionName
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Session Security (Continued from post below) nova912 PHP 1 09-05-06 10:29 AM
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' Dr. Forensics PHP 3 07-15-06 04:54 PM
I'm desperate for work, I'll do any work for cheap [PHP/MySQL] Anastas Job Offers & Assistance 17 02-12-06 12:18 PM
arrays passed via session rjwebgraphix PHP 1 01-22-06 09:00 PM
urgent: session timeout occurs unexpectedly in ASP.net seemagaur ASP.NET 3 10-12-05 12:10 AM


All times are GMT -5. The time now is 12:15 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.