Timetracker keeps logging me out -SOLVED

Discussion forum about Anuko Time Tracker
Post Reply
raisinTweezers
Posts: 3
Joined: Sat Feb 29, 2020 11:47 am

Timetracker keeps logging me out -SOLVED

Post by raisinTweezers » Sat Feb 29, 2020 11:52 am

Firstly, to any timetracker devs here: thanks for a great piece of software. I'm new to this forum.

I managed to install timetracker v. 1.19.14.5180 on a virtual server. (Your Linux quick install howto is obviously good!)

I have an issue that despite a lot of Googling I cannot seem to fix. Timetracker keeps logging me out. Things I have tried:

In WEB-INF/config.php, I set this:
define('PHPSESSID_TTL', 259200);

This only made it worse and it was logging me out in under an hour. (Sometimes it seemed like every time I went to the browser tab I had to enter my password again.) I read this forum post:
viewtopic.php?t=1830

So I created a directory /../../../tt-tmp and set its permissions to 0755 (I also tried higher permissions). Then I uncommented the line in config.php and set it to:
define('PHP_SESSION_PATH', '/../../../tt-tmp');

That made things even worse and timetracker would not let me log in at all.

Please can anyone shed some light on this?
Last edited by raisinTweezers on Thu Apr 23, 2020 7:57 pm, edited 1 time in total.

wrc
Posts: 305
Joined: Tue May 25, 2010 8:30 pm

Re: Timetracker keeps logging me out

Post by wrc » Sat Feb 29, 2020 8:05 pm

raisinTweezers wrote:
Sat Feb 29, 2020 11:52 am
So I created a directory /../../../tt-tmp and set its permissions to 0755 (I also tried higher permissions). Then I uncommented the line in config.php and set it to:
define('PHP_SESSION_PATH', '/../../../tt-tmp');

That made things even worse and timetracker would not let me log in at all.

Please can anyone shed some light on this?
Looks like you are on the right path here using PHP_SESSION_PATH, but apparently the specified directory is not accessible / usable, therefore you can't login. Make it accessible to PHP, then it will work properly. I would try using absolute path instead.

raisinTweezers
Posts: 3
Joined: Sat Feb 29, 2020 11:47 am

Re: Timetracker keeps logging me out

Post by raisinTweezers » Tue Mar 03, 2020 10:28 am

Thanks wrc. I tried creating a directory under the public_html directory and referencing that in PHP_SESSION_PATH using both absolute and relative paths, but neither worked. So I commented both the PHP_SESSION_PATH and PHPSESSID_TTL lines to revert to the default. Timetracker is now logging me out it seems every hour. That's odd as I think I read that the default is 24 hours. So I searched to find other instances of PHPSESSID_TTL, and found this in line 84 of initialize.php:

$phpsessid_ttl = defined('PHPSESSID_TTL') ? PHPSESSID_TTL : 60*60*24;

To me that looks like 24 hours, or am I wrong? What would happen if I edited that line to, say, 60*60*192? Or is there anything else I can try?

Thanks again for your help.

peter
Posts: 85
Joined: Sat May 29, 2010 2:06 pm

Re: Timetracker keeps logging me out

Post by peter » Tue Mar 03, 2020 2:33 pm

raisinTweezers wrote:
Tue Mar 03, 2020 10:28 am
... Timetracker is now logging me out it seems every hour. That's odd as I think I read that the default is 24 hours.
It' is not Time Tracker that logs you out. You run other applications in there that expire your sessions from a commonly shared directory. To resolve the problem, you need to keep the sessions separate.
raisinTweezers wrote:
Tue Mar 03, 2020 10:28 am
$phpsessid_ttl = defined('PHPSESSID_TTL') ? PHPSESSID_TTL : 60*60*24;

To me that looks like 24 hours, or am I wrong? What would happen if I edited that line to, say, 60*60*192? Or is there anything else I can try?
See above, nothing will help until you rersolve the underlying prtoblem of other apps interfering. You need to keep TT sessions in a separate directory for every instance of TT that you may run there,

Add this to initialize.php:

Code: Select all

echo session_save_path();
echo('<br>');
echo(__FILE__);
after:

Code: Select all

// Set PHP session path, if defined to avoid garbage collection interference from other scripts.
if (defined('PHP_SESSION_PATH')) {
  ini_set('session.save_path', PHP_SESSION_PATH);
  ini_set('session.gc_probability', 1);
}
So that the code fragment looks like:

Code: Select all

$phpsessid_ttl = defined('PHPSESSID_TTL') ? PHPSESSID_TTL : 60*60*24;
// Set lifetime for garbage collection.
ini_set('session.gc_maxlifetime', $phpsessid_ttl);
// Set PHP session path, if defined to avoid garbage collection interference from other scripts.
if (defined('PHP_SESSION_PATH')) {
  ini_set('session.save_path', PHP_SESSION_PATH);
  ini_set('session.gc_probability', 1);
}
echo session_save_path();
echo('<br>');
echo(__FILE__);
The above will print current session path and initialize.php file path on pages, which may help you to find a real path to use for TT sessions.

Or buy a support incident for quicker resolution.

raisinTweezers
Posts: 3
Joined: Sat Feb 29, 2020 11:47 am

Re: Timetracker keeps logging me out

Post by raisinTweezers » Thu Apr 23, 2020 7:55 pm

Sorry for the delay in replying. Thank you both for your help. Peter, your instructions worked perfectly! Thanks again

Post Reply