h1

Install Moodle 1.8 under Apache/Vista

June 7, 2007

Moodle is usually easy to install once you’ve got Apache/PHP 5/MySQL running.

But the installation script for Moodle 1.8 fails- hitting ‘Next’ after entering the database information gave me a blank screen. EDIT: This also is true of Moodle 1.9 beta.

The install works fine under XP. But the problem isn’t limited to Vista: John McGrath and others on moodle.org report a similar problem under XAMPP/Win2000. John manually built his configuration file to get Moodle running (http://moodle.org/mod/forum/discuss.php?d=64692).

I was able to install Moodle 1.8 successfully under Vista following his approach.

  1. Install the Apache webserver. I’m using Apache 2.2.4.
  2. Install MySQL 5 (The most recent installer (5.0.41) works without a hitch under Vista. Don’t forget to unblock port 3306 in your firewall, and set sql-mode=”” in your my.ini file; Moodle doesn’t like strict mode).
  3. Install PHP 5. I’m using version 5.2.3.
  4. Download the latest stable build of 1.8+ from http://download.moodle.org/download.php/stable18/moodle-latest-18.zip.
  5. Unzip the file into your Apache document root (c:\apache\htdocs, if you follow the instructions linked in step one). I renamed the directory c:\apache\htdocs\moodle18, so I could install multiple versions of moodle later for testing.
  6. Create a directory for storing data that is outside the document root (I used c:\apache\htdata).
  7. Create an empty database for Moodle 1.8. I used mysql:
    1. Get a command line (All Programs > Accessories > Command Line) and start up mysql:
      mysql -u root -p
    2. After giving mysql your root password, you should see a welcome message. At the mysql prompt, type:
       create database moodle18;
       grant select,insert,update,delete,create,drop,
          index,alter on moodle18.* to moodle@localhost
          identified by 'put-a-moodle-password-here';
       quit;
      
  8. Double check your php.ini file. Moodle requires the following to be set somewhere in php.ini:
    session.auto_start = 0
    magic_quotes_gpc = On
    magic_quotes_runtime = Off
    register_globals = Off
    sql.safe_mode = Off
    file_uploads = On
    memory_limit = 128M
    upload_max_filesize = 64M
    post_max_size = 64M
    extension=php_gd2.dll
    

    Moodle won’t complain if you leave magic_quotes_gpc off, but Joomla will.

    64 megabytes is just a little larger than my largest course backups- if I set it any smaller, I won’t be able to upload them through Moodle.

  9. Create a Notepad file in your Moodle directory and call it config.php (c:\Apache\htdocs\moodle18\config.php, for me):
    <?php /// Moodle Configuration File
    
    unset($CFG);
    
    $CFG->dbtype = 'mysql';
    $CFG->dbhost = 'localhost';
    $CFG->dbname = 'moodle18';
    $CFG->dbuser = 'moodle';
    $CFG->dbpass = 'put-a-moodle-password-here';
    $CFG->dbpersist = false;
    $CFG->prefix = 'mdl_';
    
    $CFG->wwwroot = 'http://localhost/moodle18';
    $CFG->dirroot = 'C:\Apache\htdocs\moodle18';
    $CFG->dataroot = 'C:\Apache\htdata';
    $CFG->admin = 'admin';
    
    $CFG->directorypermissions = 00777; // try 02777 on a server in Safe Mode
    
    $CFG->unicodedb = true; // Database is utf8
    
    require_once("$CFG->dirroot/lib/setup.php");
    // MAKE SURE WHEN YOU EDIT THIS FILE THAT THERE ARE NO SPACES, BLANK LINES,
    // RETURNS, OR ANYTHING ELSE AFTER THE TWO CHARACTERS ON THE NEXT LINE.
    ?>
    

    Put in your own paths and passwords.

  10. Browse to your Moodle directory (http://localhost/moodle18, for me) and the install script should take it from there!
Advertisements

4 comments

  1. It can be installed with XAMPP as well. I posted something over at Moodle.org that should walk someone who is unfamiliar with Apache etc. right through it. I hope you find it useful.

    Here is the URL:

    http://moodle.org/mod/forum/discuss.php?d=73852&parent=349700


  2. Thanks!
    Very usefull.


  3. I tried NineHub.com provides free Moodle hosting with unlimited disk space and bandwidth. Good enough!


  4. […] Solution: Manually create the setting file “config.php” and filled in values of database, data folder etc. as mentioned in the following site: https://senese.wordpress.com/2007/06/07/install-moodle-18-under-apachevista/ […]



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: