Multiple moodles on the same ISP account - more help needed

Multiple moodles on the same ISP account - more help needed

by diane ehrlich -
Number of replies: 2
We want to create a second moodle environment on the same ISP account.  What I have concluded from various posts to the forums that what we should do is to make a complete copy of all the "/moodle" folders to a set of "/moodle2" folders, and then change the config.php file of the moodle 2 folder set.  The other issue is that my ISP only permits us one mysql database, but this was theoretically resolved by a forum post that we only need additional mysql tables in the same database, and that we can set up separate table name prefixes for the two different moodles in the config files.  With that as an introduction, here is my question: I have noticed that in my current set of ISP folders, I have a moodle folder and a moodledata folder (both at the same level off my webroot).  In order to create a second moodle environment, do I need to create both a moodle2 folder AND a moodledata2 folder?? Also I heard a rumor about trouble with multiple moodle cookies, but I can most likely avoid that pothole by deleting all my cookies when I switch from moodle to moodle2. Please help and thank you in advance.
Average of ratings: -
In reply to diane ehrlich

Re: Multiple moodles on the same ISP account - more help needed

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Ok... this is really easy (honest).

  • Make two completely separate copies of the moodle files, so you end up with (e.g.) http://myhost.mydomain/moodle1 and http://myhost.mydomain/moodle2
  • Make two completely separate moodledata areas
  • You only need one database - that's what the $CFG->prefix setting in config.php is for (you get asked for it in the automatic install too). Simply make that something different (default is 'mdl_') and a new set of tables will be created with the different prefix.
  • Set up your second config.php, or just let the automatic install run, and make the appropriate settings.
  • In Admin->Variables give each one a different session name (stops problems on clients where both are in use at once)

That's it!

If you need any more help let us know.

In reply to Howard Miller

Re: Multiple moodles on the same ISP account - more help needed

by Wayne Hoang -

Hello,

We are trying to the same but wondering if we can just use 1 moodle folder (and 1 config.php).  This config page will pull the $CFG->prefix from a session variable set at the beginning of the session to indicate which sets of table (thus having the same prefix eg math_, science_) instead of the default mdl_.  So we try to do this:

Session_start();

$CFG->prefix =  $_session["prefix"];

The config.php page somehow does not recognize the $_session["prefix"] variable we passed in.  Other pages do recognize that this variable exists however.  Is there something about this page that resets the session?

I am new to Moodle and PHP so I apologize if this question is too elementary.

Thanks,

Wayne