Quiz maximum size?
Number of replies: 34I am using Moodle 1.2.1 running on Apache 1.3.29 and PHP 4.3.4.
A teacher made a quiz which has 76 questions. The problem is that
when students want to submit their answers, for some students it works, for others,
they are back to the login page.
The site-wide session timeout is set to 4 hours, the quiz has a time limit but students were within
this limit.
Maybe the whole form that is transmitted is limited in size?
Thanks,
Marc Delisle
phpMyAdmin.net
Increasing session time (Re: Quiz maximum size?)
Re: Increasing session time (Re: Quiz maximum size?)
The same happend to me this evening testing a quiz, with 60 questions/1.5 h work ...
- First login screen
- then "Course module is incorrect"
- and datas has gone ..
Fortunatly only a test ..I am testing now with increased "session.gc_maxlifetime" in .htaccess (10000 instead of 1400 normaly ) ..
BUT
a possibility to seperate a quiz in several pages would stop this problem...
there are examine-situations you can not split up in several different quizes...
Greatings from the green heart of Austria/Styria
Peter
Re: Increasing session time (Re: Quiz maximum size?)
session.gc_maxlifetime 10000 has no positive result for this problem ...
4 h are defined in the admin menu
after 50 minutes session is closed ...
any other idea?
Peter
Re: Increasing session time (Re: Quiz maximum size?)
Re: Increasing session time (Re: Quiz maximum size?)
in the results of my php.php the actual variable is :
session.gc_maxlifetime | 50000 | 1440 |
Maybe a php bug?
I think running out of session time will be a big problem - not only for me, in quiz, lesson and other moduls, which depend on interactivity without saving results for a longer time (1-2 hours groupe work ...) ...
What we would need is a single dummy request to the server "hi I am still alive"
Is this possible?
Thanks Peter
Re: Increasing session time (Re: Quiz maximum size?)
Re: Increasing session time (Re: Quiz maximum size?)
- we will test it, and post the results,
- but as I know the enviroment of my provider (good friend) he uses the .htaccess methode for other application, there is one application running with timeout 24 hours (weboffice system), only with adding the increased value to .htaccess
but whats about a "i am still alive" feature ..
peter
p.s.: for this moment i will split up the quiz in 4 parts , no part longer than 20 min ...maybe confusing for the students (80 in one Test!), but better then losing all datas ...
Re: Increasing session time (Re: Quiz maximum size?)
I have this problem also across 3 installations on 3 different servers of moodle all running different versions of php ! it was never a problem until I upgraded to the lastest version of Moodle. Now changing htaccess doesnt work , and being on shared hosting means they are not will to change the php.ini file. I have other php scripts running in a subdomain of 2 of these servers and they are set to 14400 and no log outs. But moodle and the quiz module seems to be a problem... it appears to be only the quiz module too from my experiments.
For your student my work around was to change the quiz set up to select ' build on attempts' then get ths students to log out at 50 minutes, then restart the quiz of course this doesnt work if you have random questions or shuffle questions selected.
Chris
Re: Increasing session time (Re: Quiz maximum size?)
Howvere, please keep reporting experimentation - it may help towards a solution.
One workaround is to open a second window into the same course and use it now and then. A chat window would do the trick all by itself.
Re: Increasing session time (Re: Quiz maximum size?)
We are testing right now, but it takes from one test to the next 1 hour ..., I will report results
Chat-Window: Great idea, Students will like you as Testing - Teacher , Online chat, but we would have the chat log ....
Maybe a window, which opens automaticly when a test is started and makes the refresh in background (should be easy to implement, if somebody knows how to do... )
Peter
Re: Increasing session time (Re: Quiz maximum size?)
I have an idea .. I think session files might be deleted in a common area on a server regardless of which software package created them. Please try this in your .htaccess:
php_value session.save_path /home/myaccount/moodledata/sessions
where the pathname is to a directory somewhere in your $CFG->dataroot directory that has full read-write permissions.
Re: Increasing session time (Re: Quiz maximum size?)
Hi Martin, i will try this and report results
Last information: changing php.ini on server make it work, but may raise security problems with longer open sessions ...
Peter
Re: Increasing session time (Re: Quiz maximum size?)
After the section about "session timeouts" add these lines:
/// Set custom session path
if (!file_exists("$CFG->dataroot/sessions")) {
make_upload_directory('sessions');
}
ini_set('session.save_path', "$CFG->dataroot/sessions");
Here is the problem. The garbage collection of old sessions takes place when sessions are used (PHP doesn't have a cron). However garbage collection can't distinguish between session files from different sites, and by default they are all kept in the same directory (usually /tmp). So if you have a Site A (20 minutes) and a Site B (30 minutes) on the same server, then the garbage collection for Site A will always clean up session files from all sites after 20 minutes.
The solution is to move the session files for Site B into a separate directory. My changes standardise this by moving all the session files for a given Moodle site into a folder called "sessions" inside the dataroot directory. Let's see how it goes.
(edited to fix URL)
Re: Increasing session time (Re: Quiz maximum size?)
did you test it in PHP safe mode?
Thanks,
Marc Delisle
Re: Increasing session time (Re: Quiz maximum size?)
Let us know how you go though.
Re: Increasing session time (Re: Quiz maximum size?)
Re: Increasing session time (Re: Quiz maximum size?)
I have done this change on one site and have started the test 15 minutes ago, will post if it works for me here in Florida...
Re: Increasing session time (Re: Quiz maximum size?)
Martin it works,
1.)moodledata/sessions with all rights
2.) Changing lib/setup.php (your script)
3.) In .htaccess (moodle root)
- I removed the hardcoded (your first advice):
php_value session.save_path /home/myaccount/moodledata/sessions. - and increased php_value session.gc_maxlifetime 10000
4.) server php.ini was set to normal 1400
I tested this serveral times with success ...
Maybe you should add this to CVS ...because the next update will delete this changes ..
Thanks for your (quick!!!) help
Peter
Re: Increasing session time (Re: Quiz maximum size?)
Note that all you need is the new lines in lib/setup.php (which are in CVS already now).
- you don't need to create the directory manually (it's done for you)
- you don't need anything in .htaccess (the variable on the configuration web page works now)
Re: Increasing session time (Re: Quiz maximum size?)
Great job Martin, thank you!
Peter
Re: Increasing session time (Re: Quiz maximum size?)
I just put:
/// Set custom session path
if (!file_exists("$CFG->dataroot/sessions")) {
make_upload_directory('sessions');
}
ini_set('session.save_path', "$CFG->dataroot/sessions");
AFTER
/// Set session timeouts
if (!empty($CFG->sessiontimeout)) {
ini_set('session.gc_maxlifetime', $CFG->sessiontimeout);
}
and reloaded my moodle page. I got no page at all with this, i.e., emptiness. Did I put it in the wrong place?
Jay
Re: Increasing session time (Re: Quiz maximum size?)
Re: Increasing session time (Re: Quiz maximum size?)
I forgot to mention that I had this problem also in Moodle 1.1.
I just changed the setting in php.ini from 1440 to 50000 and I will report.
Note that here, PHP is running in safe mode, maybe that's why Moodle cannot change
this setting.
Marc
Re: Increasing session time (Re: Quiz maximum size?)

Re: Increasing session time (Re: Quiz maximum size?)


Re: Increasing session time (Re: Quiz maximum size?)
Chris,
Does your testing just relate to Martin's latest changes to setup.php , or all the changes that Peter has suggested?
Re: Increasing session time (Re: Quiz maximum size?)
I did the changes to the setup.php and also added a sessions directory chmod'd to 777 in the moodle data directory as suggested by Martin. Then presto magic it worked, I didnt have the .htaccess file in my moodle directory so I had no need to play with this. I will try it on the 2 other servers I have moodle on tonight and see how she goes.
Chris
Re: Increasing session time (Re: Quiz maximum size?)
Re: Increasing session time (Re: Quiz maximum size?)
Re: Increasing session time (Re: Quiz maximum size?)
No, I need to manually create the sessions directory with mode 0777 after I got the following error:
Warning: mkdir(/home/.../woldata/sessions): Permission denied in
/home/.../public_html/wol/lib/moodlelib.php on line 1013
ERROR: Could not find or create a directory
(/home/.../woldata/sessions)
Stan
Re: Increasing session time (Re: Quiz maximum size?)
Re: Increasing session time (Re: Quiz maximum size?)
Dear Martin:
I follow all this treat, but it seams that I get lost some where, and I just cant understand what to do to solve this problem. I made a 30 questions quiz for my students. I was very happy of how it function until I give it to my students. I was really frustrating, because they work for more than an hour, and when they wanted to send it, the system brings them a message, and lost all their answers, and they had to begin again.
I have Moddle 1.2.1What should I do?
Please note that English is not my language and that Im not an expert on linux, php, mysql or any kind of language.
Where do I have to make changes to give more time to my students giving their quiz???
Re: Increasing session time (Re: Quiz maximum size?)
Hi,
That has been my problem too, but it is solved now(thanks martin!)
normaly,in 1.2.1 you only have to increase the "sessiontimeout - variable" in the moodle admin/configure variable menu ...
that is the only change which should be necessary.
You may control the correct installation in
- ../moodledata/sessions
- if you find the directory SESSIONS and files looking like this: "sess_02534cb7fbbcdb03dea1d3ec6f1a6111" it should be ok ...
all other possibilities (there are some) should only be done by admins and php experts ...
Peter