.htaccess php_value
Started on the old forum in January 2010 · view the original in the archive · old links redirect here
have you tried to add ini_set(); in to your script? like:
ini_set('session.use_cookies',0);
ini_set('session.gc_maxlifetime',20);
ini_set('session.name','SID');
to test which value is set do this:
echo ini_get("session.gc_maxlifetime");
there is also another way like
session_cache_expire(1); //1 minute
session_name("SID");
Advertise your mobile site for FREE with AdTwirl
= = = = = index.php = = = = =
<?php ini_set('session.use_cookies',0); ini_set('session.gc_maxlifetime',20); ini_set('session.name','SID'); session_start(); $_SESSION["key"] = "Session alive "; echo '[Go to another page](#)'; ?>= = = = = the another.page = = = = =
<?php session_start(); if(isset($_SESSION["key"])) { echo $_SESSION["key"]; } else { echo "Session died "; } echo 'Refresh this page after 25 seconds please to see result ... '; echo 'Value of session.gc_maxlifetime is "'.ini_get("session.gc_maxlifetime").'"'; ?>This ^ example. It's right? Does not work...
GumSlone wrote: have you tried to add ini_set(); in to your script? like:
ini_set('session.use_cookies',0); ini_set('session.gc_maxlifetime',20); ini_set('session.name','SID');to test which value is set do this:
echo ini_get("session.gc_maxlifetime");there is also another way like
session_cache_expire(1); //1 minute session_name("SID");
wow, its luk lyk amazing, but will u give me proper information where i can put this code?
like any idiot knows lol
BEFORE YOUR HEADERS OMFG DUDE!!!
Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!
SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…
PoV@rEsK wrote: = = = = = index.php = = = = =
<?php ini_set('session.use_cookies',0); ini_set('session.gc_maxlifetime',20); ini_set('session.name','SID'); session_start(); $_SESSION["key"] = "Session alive "; echo '[Go to another page](#)'; ?>= = = = = the another.page = = = = =
<?php session_start(); if(isset($_SESSION["key"])) { echo $_SESSION["key"]; } else { echo "Session died "; } echo 'Refresh this page after 25 seconds please to see result ... '; echo 'Value of session.gc_maxlifetime is "'.ini_get("session.gc_maxlifetime").'"'; ?>This ^ example. It's right? Does not work...
you have to include this:
ini_set('session.use_cookies',0);
ini_set('session.gc_maxlifetime',20);
ini_set('session.name','SID');
to every page.
Advertise your mobile site for FREE with AdTwirl
-
-
- sessions_including.php * * *
-
-
-
- index.php * * *
-
-
-
- another_page.php * * *
-
-
-
- Demo * * *
-
ori wrote: 20 = 20 minutes if im right... my site has sessions active for 1 year lol but logout kills the session using unset()
no its seconds
this should work:
header("Cache-Control: no-cache, must-revalidate");
ini_set('session.use_cookies',0);
ini_set('session.gc_maxlifetime',20);
ini_set('session.gc_probability',1);
ini_set('session.gc_divisor',1);
ini_set('session.name','SID');
session_start();
Advertise your mobile site for FREE with AdTwirl
or you can do this too:
<?php
header("Cache-Control: no-cache, must-revalidate");
$session_lifetime = 20;
ini_set('session.use_cookies',0);
ini_set('session.gc_maxlifetime',$session_lifetime );
ini_set('session.gc_probability',1);
ini_set('session.gc_divisor',1);
ini_set('session.name','SID');
session_start();
?>
-
-
- index.php * * *
-
<?php
require("sessions_including.php");
$_SESSION["key"] = "Session alive<br /><br />";
$_SESSION["create_time"] = time();
echo '<a href="another_page.php?'.SID.'">Go to another page</a>';
?>
-
-
- another_page.php * * *
-
<?php
require("sessions_including.php");
if((time()-$session_lifetime) > $_SESSION["create_time"]){session_destroy(); @unset($_SESSION);}
if(isset($_SESSION["key"])) {
echo $_SESSION["key"];
}
else {
echo "Session died<br /><br />";
}
echo 'Refresh this page after 25 seconds please to see result ...<br />';
echo 'Value of session.gc_maxlifetime is "'.ini_get("session.gc_maxlifetime").'"';
?>
Advertise your mobile site for FREE with AdTwirl
GumSlone, your first example is works, and as i found out it will work too:
-
-
- .htaccess * * * php_value session.use_cookies 0 php_value session.gc_maxlifetime 20 php_value session.gc_probability 1 php_value session.gc_divisor 1 php_value session.name SID
-
But there is one thing that i can't understand. See below...
-
-
- Demo * * *
-
PoV@rEsK wrote: GumSlone, your first example is works, and as i found out it will work too:
- .htaccess * * * php_value session.use_cookies 0 php_value session.gc_maxlifetime 20 php_value session.gc_probability 1 php_value session.gc_divisor 1 php_value session.name SID
But there is one thing that i can't understand. See below...
- Demo * * *
yes i have tested it at my host too, only after you refresh the page the session is destroyed, hmm dont know why.
This is what i got from php.net site:
session.gc_probability integer session.gc_probability in conjunction with session.gc_divisor is used to manage probability that the gc (garbage collection) routine is started. Defaults to 1. See session.gc_divisor for details. session.gc_divisor integer session.gc_divisor coupled with session.gc_probability defines the probability that the gc (garbage collection) process is started on every session initialization. The probability is calculated by using gc_probability/gc_divisor, e.g. 1/100 means there is a 1% chance that the GC process starts on each request. session.gc_divisor defaults to 100.
probably the garbage collector is runing only when refresh the page, i think this should not happen when you have many users at your site.
Advertise your mobile site for FREE with AdTwirl