I found myself being logged out from my local Moodle site after a relatively short period of inactivity. Now my students are saying that after doing a quiz instead of returning to the course home page they are going to the login page. The question is what is the session time?
The answer is found elsewhere in the forums, it's the PHP parameter session.gc_maxlifetime. The entry says it's normally set to two hours. Strange I thought, it didn't feel like two hours. Having a look at my php.ini I find to my horror that's its set to 1440, 24 minutes! Which fits more in with my gut feeling for when I'm logged off. And my poor student pondering over a quiz for half hour "goes home with nothing".
My local server is a very standard debian (woody) straight out the box (if it had a box). Does anyone know where this value of 1440 came from, is it just Debian that is setting it so low?
PS just had a look at a PHP 4.2.2 build on Mandrake and the session lifetime is 1440 seconds for that as well.
You're right, the default is 1440. I don't know where I got the idea that 7200 is default - I must have changed it years ago on my servers and forgotten about it.
Anyhow, here is the entry you can set in .htaccess:
and I'll make this a new setting on the Moodle admin variables page as well.
Anyhow, here is the entry you can set in .htaccess:
php_value session.gc_maxlifetime 7200
and I'll make this a new setting on the Moodle admin variables page as well.
I don't think putting it $CFG will work, as if you do a set_ini(), that will only last for that page view. I could be wrong though, I haven't tested that.
A few days ago (I was about to post this myself), I added the following lines to my .htaccess
# makes sessions last 2.777... hours (10000 seconds)
php_value session.gc_maxlifetime 10000
What I do think would be neat (and I just may get around to coding this myself if no one else does), is to create a data structure containing various PHP INI settings, and the recommended values for use with Moodle. At the bottom of admin/config.php (or in one of the pages shown when you ugrade your moodle), would be a mini php_info like table ala the following
setting | recommended value | your value
session.gc.maxlifetime | 7200 | 10000
file.uploads | 1 | 1
etc etc etc
A few days ago (I was about to post this myself), I added the following lines to my .htaccess
# makes sessions last 2.777... hours (10000 seconds)
php_value session.gc_maxlifetime 10000
What I do think would be neat (and I just may get around to coding this myself if no one else does), is to create a data structure containing various PHP INI settings, and the recommended values for use with Moodle. At the bottom of admin/config.php (or in one of the pages shown when you ugrade your moodle), would be a mini php_info like table ala the following
setting | recommended value | your value
session.gc.maxlifetime | 7200 | 10000
file.uploads | 1 | 1
etc etc etc
I'm pretty sure it will work when called before creating the session. I'm testing it now.
I like the idea about the mini-phpinfo table!
I like the idea about the mini-phpinfo table!