Hi
I have been tearing my hair out with this. As part of a backend perl script i am holding the Epoch time as session data using apache session and mysql so i can delete sessions after an expiry period. When I retrieve the time it is about three months old even when i only just set it. The code example below best describes the problem:
I have got the table set up that Apache session requires.
Code:
#!/usr/bin/perl
use strict;
use DBI;
use Apache::Session::MySQL;
my %config;
$config{'dbname'} = "somedatabase"; # Database name
$config{'dbuser'} = "root"; # Database user
$config{'dbpass'} = "secret"; # Database password
my $dbhg = DBI->connect("dbi:mysql:$config{'dbname'}",$config{"dbuser"},$config{"dbpass"})
or die "Could not open MySQL DataBase - SQL Error: $DBI::errstr\n";
my %session;
tie %session, 'Apache::Session::MySQL', undef, {Handle=>$dbhg, LockHandle=>$dbhg};
my $sessid = $session{_session_id};
print "New session:$sessid\n";
$session{'time'} = time;
print "Time set: $session{'time'}\n";
untie %session;
#### Now to retie the session and retrieve the time
tie %session, 'Apache::Session::MySQL', $sessid, {Handle=>$dbhg, LockHandle=>$dbhg};
print "Connected session:$session{_session_id}\n";
my $retrievedTime = $session{'time'};
print "Retrieved time: $retrievedTime\n";
untie %session;
This gives the output:
Code:
New session:14199f84b1e646b528d63b3be180a9b1
Time set: 1302529444
Connected session:14199f84b1e646b528d63b3be180a9b1
Retrieved time: 1295975743
This is happening on 3 out of four machines all running Debian. It works fine on the one!?!?!
Anyone got any ideas?