For some reason, i have a windows 2003 enterprise, php5 (using fast cgi), mysql 5, box running moodle (with ldap authentication against windows 2003 AD). In some section (that the admin user of moodle uses) when they add a Teacher to a course, the application pool goes offline and then we get a happy "Service Unavailable" message for all the server.

During creation of courses in Moodle I found certain section paricularly adding teachers to courses brought IIS down with the 'service unavailable' error up. When I restart the service on the server it is fine.
The director of ict here (Jon Lunn) is the one trying to get this to work Moodle Forums

Coming from a techie side, is there anyway i can trace whats happening on the IIS server stepping through so to speak so i can see what tips it over the edge?

Has anyone else had anything like this happen?

thanks in advance


### How to fix ###

After mucking about a bit, I tracked it down to this, Lines 97 to 111 in file moodle/course/teacher.php

PHP Code:
/// Add a teacher if one is specified

if (!empty($_GET['add']) and confirm_sesskey()) {
     if (! 
add_teacher($add$course->id)) {
error("Could not add that teacher to this course!");

/// Remove a teacher if one is specified.

if (!empty($_GET['remove']) and confirm_sesskey()) {
        if (! 
remove_teacher($remove$course->id)) {
error("Could not remove that teacher from this course!");
Does some stuff with sesskey things.

After looking where it looks to get the confirm_sesskey() function i went to the config.php

In file moodle/config.php, line 20,
PHP Code:
So in this file (I know, long follow) moodle/lib/setup.php
I uncommented lines 333 and 334

PHP Code:
/// In VERY rare cases old PHP server bugs (it has been found on PHP 4.1.2 running
/// as a CGI under IIS on Windows) may require that you uncomment the following:

This worked for me.