Installing Moodle on 5.0-Nano: Difference between revisions

Jump to navigation Jump to search
m
no edit summary
mNo edit summary
Line 1: Line 1:
<span id="top"></span>
<span id="top"></span>
{| cellpadding="2"
{| cellpadding="2"
|__TOC__||'''Installing Moodle on 5.0-Nano'''
|__TOC__||'''Installing Moodle on 5-Nano Series'''
|}
|}
'''Introduction'''
'''Introduction'''


This step-by-step guide shows how to install Moodle on Uniform Server V5.0-Nano. In addition shows how to resolve fixed paths allowing Moodle to be run from a USB memory stick.
This step-by-step guide shows how to install Moodle on Uniform Server V5-Nano. In addition shows how to resolve fixed paths allowing Moodle to be run from a USB memory stick.


Windows does not support true cron jobs however V5.0-Nano has an integrated portable Cron catering for both hard drive and USB memory stick installations.   
Windows does not support true cron jobs however V5-Nano has an integrated portable Cron catering for both hard drive and USB memory stick installations.   


== Pre-Installation ==
== Pre-Installation ==
Line 16: Line 16:


# '''A)''' Create a new folder named '''moodle_b''' (Can be any name)
# '''A)''' Create a new folder named '''moodle_b''' (Can be any name)
# Extract a new copy of Uniform Server V5.0-Nano to this folder<br>(Double click on file to extract).  
# Extract a new copy of Uniform Server V5.5-Nano to this folder<br>(Double click on file to extract).  


'''''Download Moodle'''''  
'''''Download Moodle'''''  
Line 275: Line 275:


Admin login
Admin login
* Username: ''' boss'''
* Username: '''admin'''
* Password: '''fred123'''
* Password: '''UniServer-54'''
'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''


Line 291: Line 291:
UniServer\www\moodle\'''config.php'''  
UniServer\www\moodle\'''config.php'''  


Its a small file locate the following three lines (yours may be slightly different):
Its a small file locate the following lines (yours may be slightly different):
{|
|-
|
<pre>
<pre>
$CFG->dbtype    = 'mysql';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'moodle';
$CFG->dbuser    = 'root';
$CFG->dbpass    = 'root';
$CFG->dbpersist =  false;
$CFG->prefix    = 'mdl_';
$CFG->wwwroot  = 'http://localhost/moodle';
$CFG->wwwroot  = 'http://localhost/moodle';
$CFG->dirroot  = 'C:\moodle_b\UniServer\www\moodle';
$CFG->dirroot  = 'C:\moodle_b\UniServer\www\moodle';
$CFG->dataroot  = 'C:\moodle_b\UniServer/moodledata';
$CFG->dataroot  = 'C:\moodle_b\UniServer/moodledata';
</pre>
$CFG->admin    = 'admin';
The hard coded paths start with '''C:''' followed by a list of folders to the Moodle installation these hard coded paths prevent portability. Another problem, first line assumes you are running servers on localhost and standard port 80 this becomes an issue if you run [[#Move Servers | '''move servers''']] (multi-server operation) because it changes all ports.  
</pre>  
|}
Second line assumes you are running the MySQL server on standard port 3306.
 
Another problem, eighth line assumes you are running servers on localhost and standard port 80 this becomes an issue if you run [[#Move Servers | '''move servers''']] (multi-server operation) because it changes all ports.
 
Hard coded paths start with '''C:''' followed by a list of folders to the Moodle installation these hard coded paths prevent portability.   


Solution is to let PHP automatically calculate absolute paths and web-root folder.
Solution is to let PHP automatically calculate absolute paths and web-root folder including ports used.


Replace the above three lines with the following code:
Replace the above lines with the following code:
{|
|-
|
<pre>
<pre>
$splitArray  = explode("\\www",__DIR__);  // Split at folder www to
// === MPG Set base path ======================================================
$base         = "$splitArray[0]";         // find drive letter and sub-folders
$path_array = explode("www", dirname( __FILE__ ));  // Split path at www
$base          = "$path_array[0]";            // absolute path to ..UniServer/
// ================================================== MPG End Set base path ===
 
// === MPG Get MYSQL port =====================================================
// Use port from configuration file - because user can change this file
$file_conf  = $base.'usr\\local\\mysql\\my.ini'; // Config file
 
if ($filearray=file($file_conf)) {              // read file into array
foreach ($filearray as $txt) {                // scan array for port
  if(preg_match("/^\s*port\s*=\s*(\d+)/", $txt,$match)){ // check save matches
  $mysql_port =  $match[1];                    // match found save port number
  break;                                      // give up nothing else to do
  }
}
}
else {                                      // failed to read file
echo "Cannot read the file";
}
// ===================================================== END Get MySQL Port ===
 
$CFG->dbtype    = 'mysql';
$CFG->dbhost    = "localhost:$mysql_port";
$CFG->dbname    = 'moodle';
$CFG->dbuser    = 'root';
$CFG->dbpass    = 'root';
$CFG->dbpersist =  false;
$CFG->prefix    = 'mdl_';


$root  = 'http://'.getenv("HTTP_HOST").'/moodle';        // Local testing
$root  = 'http://'.getenv("HTTP_HOST").'/moodle';        // Local testing
//$root = 'http://'.GetHostByName($REMOTE_ADDR).'/moodle'; // moving from event to event
//$root = 'http://'.GetHostByName($REMOTE_ADDR).'/moodle'; // moving from event to event


$CFG->wwwroot  = $root;
$CFG->wwwroot  = $root;
$CFG->dirroot  = $base.'\www\moodle';
$CFG->dirroot  = $base.'www\moodle';
$CFG->dataroot  = $base.'\moodledata';
$CFG->dataroot  = $base.'moodledata';
$CFG->admin    = 'admin';


</pre>  
</pre>  
|}
The above change makes Moodle completely portable.
The above change makes Moodle completely portable.


Line 464: Line 514:
* Under '''Plugins'''
* Under '''Plugins'''
* Navigate to sub-folder '''Uniform Server 5-Nano Plugins'''
* Navigate to sub-folder '''Uniform Server 5-Nano Plugins'''
* Download file [http://sourceforge.net/projects/miniserver/files/Plugins/UniServer%2055-Nano%20Plugins/Applications/V55_Moodle/V55_Moodle_l_9_5.exe/download V55_Moodle_l_9_5.exe]
* Download file [http://sourceforge.net/projects/miniserver/files/Plugins/UniServer%2055-Nano%20Plugins/Applications/V55_Moodle/V55_Moodle_l_9_7.exe/download V55_Moodle_l_9_7.exe]


Save this to folder UniServer, to install double click on file. Moodle is pre-configured and ready to go. Check out the read me file for latest information.
Save this to folder UniServer, to install double click on file. Moodle is pre-configured and ready to go. Check out the read me file for latest information.

Navigation menu