Developer Area/Developer Environment (Windows)

From Mahara Wiki
Jump to: navigation, search

Important: This guide is a simplified version of a more long-winded process and has not been tested fully. If you find any problems, feel free to edit this page.

Initial installation of your developer environment on your computer

1. Install dependencies:

The rest of the guide assumes you install these in their default locations

2. To checkout the code, open Git Bash and run the following commands:

cd /c/xampp/htdocs
git clone git://

3. Open pgAdmin. Create a user called 'maharauser' with password 'mahara', then create a database called 'mahara-master' making sure that it's owned by 'maharauser'

4. Create the file C:\xampp\htdocs\mahara\htdocs\config.php containing the following:

$cfg = new StdClass;

$branch = 'master';

// database connection details
// valid values for dbtype are 'postgres8' and 'mysql5'
$cfg->dbtype   = 'postgres8';
$cfg->dbhost   = 'localhost';
$cfg->dbport   = 5432; // Check pgAdmin for the actual port number
$cfg->dbuser   = 'maharauser';
$cfg->dbname   = "mahara-$branch";
$cfg->dbpass   = 'mahara'; 
$cfg->dbprefix = ; 

$cfg->dataroot = "C:/xampp/maharadata/$branch";

$cfg->sendemail = true;
$cfg->sendallemailto = '<your email address>';

$cfg->log_dbg_targets     = LOG_TARGET_SCREEN | LOG_TARGET_ERRORLOG;
$cfg->log_info_targets    = LOG_TARGET_SCREEN | LOG_TARGET_ERRORLOG;
$cfg->log_warn_targets    = LOG_TARGET_SCREEN | LOG_TARGET_ERRORLOG;
$cfg->log_environ_targets = LOG_TARGET_SCREEN | LOG_TARGET_ERRORLOG;
$cfg->perftofoot = true;

If you're doing a lot of development, and you're frequently adding calls to log_debug() to examine data structures, for example, you will find LOG_TARGET_SCREEN in the $cfg->log_..._targets lines will send long messages to your screen which get in the way. You can safely remove all those lines provided you watch the webserver log for warnings.

If you're mainly testing, and you don't find the stack traces in these screen messages particularly useful, adding "$cfg->log_backtrace_levels = LOG_LEVEL_ENVIRON;" to config.php will display important warning messages on a single line, without stack traces.

6. Create the directory C:\xampp\maharadata\master

7. Add the following to C:\Windows\System32\drivers\etc\hosts mahara

8. Open C:\xampp\php\php.ini. Set the following configuration ...

post_max_size = 32M

... and uncomment this line


9. Copy the following into C:\xampp\apache\conf\extra\httpd-vhosts.conf

<VirtualHost *:80>
 ServerName mahara
 DocumentRoot "C:\xampp\htdocs\mahara\htdocs"

 <Directory "C:\xampp\htdocs\mahara">
   Options Indexes FollowSymLinks MultiViews
   Order allow,deny
   Allow from all

 ErrorLog "C:\xampp\apache\logs\error.log"
 LogLevel info

 CustomLog "C:\xampp\apache\logs\access.log" combined
 DirectoryIndex index.php index.html

10. Open C:\xampp\apache\conf\httpd.conf and add the following line

LoadFile "C:/xampp/php/libpq.dll"

11. Open the XAMPP control panel and restart Apache. Go to http://mahara in your browser and you should be greeted with the Mahara installer

Installing the Mahara cron task

This allows scheduled tasks to run, which enables various features of Mahara.

1. Install cURL

2. Start Task Scheduler

3. Create a new task. Set the condition to 'Log on', set it to repeat every 1 minute indefinitely and add an action to run

curl http://mahara/lib/cron.php

It's good to set this to run as another user (in which case you'll need to set the task to run regardless of whether the user is logged on) since otherwise it will open a command window every 60 seconds.

Switching branches, using Gerrit, etc.

You should be able to do all developer actions the same way as in Ubuntu. However, make sure you use Git Bash to do them as it's a more Linux-like environment and Command Prompt and PowerShell do not support various features used in the listed commands.