spewn
Programmer
- May 7, 2001
- 1,034
i have been using this format to set and maintain session variables:
so far this works great. but today i moved my files to a new hosting company, and i'm running into an issue with the session maintaining for any period of time...sometimes the session will last for minutes or hours, and sometimes it doesn't maintain at all.
after several trial and error runs, i have realized that it's this piece of code:
i figured this out by changing the '/tmp' to 'stemp', and the session maintains just fine.
the problem is that '/tmp' seems to be a directory on the server, but isn't in my file tree, while 'stemp' is an actual folder on my file tree.
although this fix works, the 'stemp' folder will eventually be clogged with thousands of session files.
i'm not too familiar with server setups, so i don't know if '/tmp' is a real folder location, or just a reference to a temporary folder, and if so, maybe the hosting company i'm with uses something differently.
any ideas?
thanks!
- g
Code:
$cgi = new CGI;
$sid = $cgi->cookie("CGISESSID") || undef;
$session = new CGI::Session(undef, $sid, {Directory=>'/tmp'});
$cookie = $cgi->cookie(CGISESSID => $session->id);
$sSid = $session->id();
so far this works great. but today i moved my files to a new hosting company, and i'm running into an issue with the session maintaining for any period of time...sometimes the session will last for minutes or hours, and sometimes it doesn't maintain at all.
after several trial and error runs, i have realized that it's this piece of code:
Code:
{Directory=>'/tmp'}
i figured this out by changing the '/tmp' to 'stemp', and the session maintains just fine.
the problem is that '/tmp' seems to be a directory on the server, but isn't in my file tree, while 'stemp' is an actual folder on my file tree.
although this fix works, the 'stemp' folder will eventually be clogged with thousands of session files.
i'm not too familiar with server setups, so i don't know if '/tmp' is a real folder location, or just a reference to a temporary folder, and if so, maybe the hosting company i'm with uses something differently.
any ideas?
thanks!
- g