Installing Multiple Instances on Windows Server

Installing Multiple Instances on Windows Server

by Cheryl Cerda -
Number of replies: 4

I already have Moodle installed on a Windows server.  I would like to add another instance separate from the first, since another department will administer the 2nd instance.  I've already copied the Moodle and moodledata folders and modified the config.php and config-dist.php to reflect the new folder names.   I'm unable to pull up the 2nd site.  I would appreciate any suggestions.

Average of ratings: -
In reply to Cheryl Cerda

Re: Installing Multiple Instances on Windows Server

by Guillermo Madero -

Hi Cheryl,

How about the database? Each Moodle installation needs its own db, so you should have:

Moodle code (with a correct config.php file).
Moodle data directory.
Moodle database.

In reply to Cheryl Cerda

Re: Installing Multiple Instances on Windows Server

by Miguel Santos -

Hi Cheryl,

   Are you using Apache or IIS?  Also where did you put the copy of the code?

In reply to Miguel Santos

Re: Installing Multiple Instances on Windows Server

by Cheryl Cerda -

We are using Apache and MySql.  I've had the 1st instance running sucessfully for a while on http://moodle. I was able to get the 2nd instance installed to a different directory C:/HHS and using it's own database.  I am able to view both sites, using http://moodle but, of course I cannot access them at the same at the same time.   The 2nd instance, I would like to be http://moodle/HHS, if possible, unless there is a better way.   I tried modifying the config.php file in HHS/server/moodle directory as:

$CFG->dbtype    = 'mysqli';
$CFG->dblibrary = 'native';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'moodleHHS';
$CFG->dbuser    = 'root';
$CFG->dbpass    = 'MoodleHHS1!';
$CFG->prefix    = 'md2_';
$CFG->dboptions = array (
  'dbpersist' => 0,
  'dbport' => '',
  'dbsocket' => '',
);

$CFG->wwwroot   = 'http://moodle/HHS';
$CFG->dataroot  = 'C:\\HHS\\server\\moodledata';
$CFG->admin     = 'admin';

$CFG->directorypermissions = 0777;

$CFG->passwordsaltmain = '!Q>9M5zJjQ7yKTu]{j,^/=5u';

require_once(dirname(__FILE__) . '/lib/setup.php');

I just need the 2 instances named properly in all the right places.

 

In reply to Cheryl Cerda

Re: Installing Multiple Instances on Windows Server

by Luis de Vasconcelos -

I'm not sure about Apache, but in IIS you simply create two virtual directories and point each virtual directory to one of the two sites. Then you get http://moodle/HHS for the one site and http://moodle/somethingelse for the other. But you'll need to copy your Moodle application files to two folders and create two config.php files, one for each site.

But one of the horrible problems that I've found with running multiple instances of Moodle on one server (on Windows at least) is that they all run under the same instance of PHP. That means that PHP only creates one Error Log file. So, all these instances of Moodle write their error messages to that same error log file when something goes wrong in one of the sites. That makes it really hard to decipher which instance of Moodle is triggering what errors in the PHP error log file when you're digging through that error log file to try and find what's causing the problem.

So, for that reason I would much rather run Moodle on a virtual server. That way you can create one VM for each instance of Moodle. That isolates each instance completely and you don't have that problem.

Alternatively, search Moodle docs for: MULTI-TENANCY "hacks" that you can try to get it to work. You'll also find alternative Moodle distributions like Totara, Elis and Iomad that offer some form of "multi-tenancy".

Unfortunately, according to MDL-28946, multi-tenancy won't ever be coming to Moodle core...