Re: [PHP] Changing Session Timeout
On Sun, April 29, 2007 11:50 pm, Aaron Axelsen wrote: I did some more investigating, and tracked down the problem. Apparently, even though i was setting a separate save_path inside the default save path the garbage collector was still picking up the sessions in that directory. I moved the session save_path dir to a separate location and the sessions were removed according to the ini settings. The 1 weird thing I noticed is that the session cookie on the client PC is not getting set properly. I am trying to set a session timeout of 3 hours, the server is set to GMT time, and the client PC is set to CST time. The cookie on the client PC reports that it has an expiration time of 1.5 hours instead of 3. Does anyone have any ideas why thats happening? I'll say it again: If the client and the server don't agree on what time it is now, then the client will not return the cookies because they are expired. If it REALLY matters to you how long a cookie lasts you are better off having a session cookie, or a 2-year cookie (the max), and micro-managing the timing out of a session in your PHP code. I once wasted the better part of a week tracking down a session buglet because my client's web server clock as OFF by 10 *minutes* from reality... Apparently they never heard of NTP over at Microsoft... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing Session Timeout
I did some more investigating, and tracked down the problem. Apparently, even though i was setting a separate save_path inside the default save path the garbage collector was still picking up the sessions in that directory. I moved the session save_path dir to a separate location and the sessions were removed according to the ini settings. The 1 weird thing I noticed is that the session cookie on the client PC is not getting set properly. I am trying to set a session timeout of 3 hours, the server is set to GMT time, and the client PC is set to CST time. The cookie on the client PC reports that it has an expiration time of 1.5 hours instead of 3. Does anyone have any ideas why thats happening? Aaron Axelsen wrote: Everything i've read in the documentation states to call session_start after you have changed your necessary settings. Do you have a working example using session cookies I can compare this with? Richard Lynch wrote: On Fri, April 27, 2007 1:37 pm, tedd wrote: At 12:26 PM -0500 4/27/07, Aaron Axelsen wrote: With the following set, its still timing me out. I logged in and waited about 40 minutes, and it was timed out by then. This is getting very confusing, what else could it be that is causing this to not work? session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); // New Attempt session_cache_limiter(); session_cache_expire($mytimeout / 60); ini_set('session.gc_maxlifetime', $mytimeout); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); The above is not the order of your code, is it? If so, move session_start(); to the top, namely the first line of code. I don't think you want to do that... You want all those settings to take effect BEFORE you actually start the session which sends out the headers. -- Aaron Axelsen Technical Director Modevia Web Services LLC 1-866-451-9198 x802 [EMAIL PROTECTED] www.modevia.com -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing Session Timeout
On 4/27/07, Aaron Axelsen [EMAIL PROTECTED] wrote: I am trying to change my session timeout to 180 minutes, and everything ive tried has not worked. Does anyone have any idea why this isn't working properly? I currently am trying to set the following: session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); session_cache_limiter(); session_cache_expire($mytimeout); ini_set('session.gc_maxlifetime', $mytimeout); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); -- Aaron Axelsen [EMAIL PROTECTED] session_set_cookie_params requires the number given in seconds, which you did correct. But session_cache_expire requires the number given in minutes. and session.gc_maxlifetime is in minutes again. So that is correct too. you could try replace this: session_cache_expire($mytimeout); with: session_cache_expire($mytimeout / 60); That should fix it, if not, just come back, but then tell us what exactly is wrong, does the session timeout too early? does the session timeout too late? does the session timeout never? Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing Session Timeout
On 4/27/07, Aaron Axelsen [EMAIL PROTECTED] wrote: I now have the following settings: session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); // New Attempt session_cache_limiter(); session_cache_expire($mytimeout / 60); ini_set('session.gc_maxlifetime', $mytimeout / 60); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); I logged in and then left the computer untouched for an hour. When I came back the session was timed out, and I was required to login. Something still isn't working right. Any ideas? I have checked the settings using phpinfo() and confirmed that the values are in fact being set by the above commands. -- Aaron My mistake, gc_maxlifetime is in seconds, i meant to say that, but i said it was in minutes :) if you change this: ini_set('session.gc_maxlifetime', $mytimeout / 60); back to ini_set('session.gc_maxlifetime', $mytimeout); It will work i guess :) Tijnema Tijnema ! wrote: On 4/27/07, Aaron Axelsen [EMAIL PROTECTED] wrote: I am trying to change my session timeout to 180 minutes, and everything ive tried has not worked. Does anyone have any idea why this isn't working properly? I currently am trying to set the following: session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); session_cache_limiter(); session_cache_expire($mytimeout); ini_set('session.gc_maxlifetime', $mytimeout); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); -- Aaron Axelsen [EMAIL PROTECTED] session_set_cookie_params requires the number given in seconds, which you did correct. But session_cache_expire requires the number given in minutes. and session.gc_maxlifetime is in minutes again. So that is correct too. you could try replace this: session_cache_expire($mytimeout); with: session_cache_expire($mytimeout / 60); That should fix it, if not, just come back, but then tell us what exactly is wrong, does the session timeout too early? does the session timeout too late? does the session timeout never? Tijnema -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing Session Timeout
I now have the following settings: session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); // New Attempt session_cache_limiter(); session_cache_expire($mytimeout / 60); ini_set('session.gc_maxlifetime', $mytimeout / 60); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); I logged in and then left the computer untouched for an hour. When I came back the session was timed out, and I was required to login. Something still isn't working right. Any ideas? I have checked the settings using phpinfo() and confirmed that the values are in fact being set by the above commands. -- Aaron Tijnema ! wrote: On 4/27/07, Aaron Axelsen [EMAIL PROTECTED] wrote: I am trying to change my session timeout to 180 minutes, and everything ive tried has not worked. Does anyone have any idea why this isn't working properly? I currently am trying to set the following: session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); session_cache_limiter(); session_cache_expire($mytimeout); ini_set('session.gc_maxlifetime', $mytimeout); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); -- Aaron Axelsen [EMAIL PROTECTED] session_set_cookie_params requires the number given in seconds, which you did correct. But session_cache_expire requires the number given in minutes. and session.gc_maxlifetime is in minutes again. So that is correct too. you could try replace this: session_cache_expire($mytimeout); with: session_cache_expire($mytimeout / 60); That should fix it, if not, just come back, but then tell us what exactly is wrong, does the session timeout too early? does the session timeout too late? does the session timeout never? Tijnema -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing Session Timeout
With the following set, its still timing me out. I logged in and waited about 40 minutes, and it was timed out by then. This is getting very confusing, what else could it be that is causing this to not work? session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); // New Attempt session_cache_limiter(); session_cache_expire($mytimeout / 60); ini_set('session.gc_maxlifetime', $mytimeout); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); Tijnema ! wrote: On 4/27/07, Aaron Axelsen [EMAIL PROTECTED] wrote: I now have the following settings: session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); // New Attempt session_cache_limiter(); session_cache_expire($mytimeout / 60); ini_set('session.gc_maxlifetime', $mytimeout / 60); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); I logged in and then left the computer untouched for an hour. When I came back the session was timed out, and I was required to login. Something still isn't working right. Any ideas? I have checked the settings using phpinfo() and confirmed that the values are in fact being set by the above commands. -- Aaron My mistake, gc_maxlifetime is in seconds, i meant to say that, but i said it was in minutes :) if you change this: ini_set('session.gc_maxlifetime', $mytimeout / 60); back to ini_set('session.gc_maxlifetime', $mytimeout); It will work i guess :) Tijnema Tijnema ! wrote: On 4/27/07, Aaron Axelsen [EMAIL PROTECTED] wrote: I am trying to change my session timeout to 180 minutes, and everything ive tried has not worked. Does anyone have any idea why this isn't working properly? I currently am trying to set the following: session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); session_cache_limiter(); session_cache_expire($mytimeout); ini_set('session.gc_maxlifetime', $mytimeout); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); -- Aaron Axelsen [EMAIL PROTECTED] session_set_cookie_params requires the number given in seconds, which you did correct. But session_cache_expire requires the number given in minutes. and session.gc_maxlifetime is in minutes again. So that is correct too. you could try replace this: session_cache_expire($mytimeout); with: session_cache_expire($mytimeout / 60); That should fix it, if not, just come back, but then tell us what exactly is wrong, does the session timeout too early? does the session timeout too late? does the session timeout never? Tijnema -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- Aaron Axelsen Technical Director Modevia Web Services LLC 1-866-451-9198 x802 [EMAIL PROTECTED] www.modevia.com -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing Session Timeout
At 12:26 PM -0500 4/27/07, Aaron Axelsen wrote: With the following set, its still timing me out. I logged in and waited about 40 minutes, and it was timed out by then. This is getting very confusing, what else could it be that is causing this to not work? session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); // New Attempt session_cache_limiter(); session_cache_expire($mytimeout / 60); ini_set('session.gc_maxlifetime', $mytimeout); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); The above is not the order of your code, is it? If so, move session_start(); to the top, namely the first line of code. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing Session Timeout
On 4/27/07, tedd [EMAIL PROTECTED] wrote: At 12:26 PM -0500 4/27/07, Aaron Axelsen wrote: With the following set, its still timing me out. I logged in and waited about 40 minutes, and it was timed out by then. This is getting very confusing, what else could it be that is causing this to not work? session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); // New Attempt session_cache_limiter(); session_cache_expire($mytimeout / 60); ini_set('session.gc_maxlifetime', $mytimeout); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); The above is not the order of your code, is it? If so, move session_start(); to the top, namely the first line of code. Cheers, tedd Uhm, ini_set would come before session_start right? when session start is executed, then the ini value would be read right? the order is probably the problem here.. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing Session Timeout
On Fri, April 27, 2007 12:26 pm, Aaron Axelsen wrote: With the following set, its still timing me out. I logged in and waited about 40 minutes, and it was timed out by then. This is getting very confusing, what else could it be that is causing this to not work? The usual suspcect is that your server clock and your desktop clock may not agree on what time it is. The problem with relying on Cookie time out is that it relies on the user's PC clock to be correctly set. Most PC clocks are not, in fact, correct. Many are very very very incorrect. Of course, your server clock could also be off as well -- I spent days tracking down a bug like this that turned out to be caused by a server clock being off by TEN MINUTES from reality. Apparently my boss had never heard of NTP. :-v Because of this, you're better off to use session cookies or cookies with super long expiration times, and then micro-manage the timing of the expiration within PHP. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing Session Timeout
On Fri, April 27, 2007 1:37 pm, tedd wrote: At 12:26 PM -0500 4/27/07, Aaron Axelsen wrote: With the following set, its still timing me out. I logged in and waited about 40 minutes, and it was timed out by then. This is getting very confusing, what else could it be that is causing this to not work? session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); // New Attempt session_cache_limiter(); session_cache_expire($mytimeout / 60); ini_set('session.gc_maxlifetime', $mytimeout); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); The above is not the order of your code, is it? If so, move session_start(); to the top, namely the first line of code. I don't think you want to do that... You want all those settings to take effect BEFORE you actually start the session which sends out the headers. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing Session Timeout
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Everything i've read in the documentation states to call session_start after you have changed your necessary settings. Do you have a working example using session cookies I can compare this with? Richard Lynch wrote: On Fri, April 27, 2007 1:37 pm, tedd wrote: At 12:26 PM -0500 4/27/07, Aaron Axelsen wrote: With the following set, its still timing me out. I logged in and waited about 40 minutes, and it was timed out by then. This is getting very confusing, what else could it be that is causing this to not work? session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); // New Attempt session_cache_limiter(); session_cache_expire($mytimeout / 60); ini_set('session.gc_maxlifetime', $mytimeout); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); The above is not the order of your code, is it? If so, move session_start(); to the top, namely the first line of code. I don't think you want to do that... You want all those settings to take effect BEFORE you actually start the session which sends out the headers. - -- Aaron Axelsen -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGMlEWuucONIvD0AMRAp+4AKDJK9D06s+yWt4tkHw4dUhZvz0VngCgjiA3 x117Mf7dwR3VIpvuhZFxTgg= =jOud -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Changing Session Timeout
I am trying to change my session timeout to 180 minutes, and everything ive tried has not worked. Does anyone have any idea why this isn't working properly? I currently am trying to set the following: session_name('myapp'); $mytimeout = 180 * 60; // minutes * 60 session_set_cookie_params($mytimeout); $sessdir = ini_get('session.save_path')./myapp; if (!is_dir($sessdir)) { mkdir($sessdir, 0777); } ini_set('session.save_path', $sessdir); session_cache_limiter(); session_cache_expire($mytimeout); ini_set('session.gc_maxlifetime', $mytimeout); #ini_set('session.gc_probability',1); #ini_set('session.gc_divisor',1); session_start(); -- Aaron Axelsen [EMAIL PROTECTED] Great hosting, low prices. Modevia Web Services LLC -- http://www.modevia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php