The code behind OpenAustralia

Only show instructions for your platform: Ubuntu Mac Windows

How to install the web application

This document goes over how we have set up the OpenAustralia web application on our development machines.


For a server set up, you can use this as a base however it might require a different approach unless you have complete control (i.e. you are root) on the server and can install all the dependencies, secure the machine, etc. So, use these instructions as a starting point rather than a definitive “this is the ultimate way” step-by-step guide.


If you don’t have the version control system git you’ll need to install it.


git clone git://
cd openaustralia
git submodule init
git submodule update

Install the dependencies

We need the following bits and pieces

(we’ve tested with Apache 2.X.X, PHP5, MySQL 5.0.x)

Max OS X Leopard

Apache, PHP and Ruby all come with Leopard. If you need to install any of these
on Mac OS X (if for whatever reason you don’t have them installed) there’s a ton
of information online:

  1. Entropy’s Instructions
  2. Hivelogic’s Instructions

You should also be able to get MySQL from MySQL’s website as they now distribute binary versions for Mac OS X (at the time of writing this document, you can find the 5.0.51a MySQL Community Server at MySQL Community Server).

As the parsing of XML files to insert into the database is done with Perl (and there’s quite a few scripts in Perl), you will need a few Perl CPAN modules:

sudo perl -MCPAN -e shell
cpan> install Error
cpan> install XML::Twig
cpan> install DBD::mysql
cpan> install XML::RSS

Ubuntu 8.04

Use apt-get to install the requirements:

sudo apt-get install apache2 php5 php5-cli mysql-server libmysqlclient15-dev php5-mysql liberror-perl libxml-twig-perl libdbd-mysql-perl libxml-rss-perl

# Enable the apache modules.
a2enmod php
a2enmod rewrite


Apache, PHP and MySQL can all be installed together with the Xampp for Windows package. Perl can be downloaded from ActiveState in the ActivePerl package.


The x86 version of ActivePerl comes with a GUI for installing packages that makes the whole process a lot easier. Refer to for instructions on running it. ActivePerl comes with a lot of packages already installed but there are a few you’ll need to install yourself, namely: XML-Twig, DBD-mysql and Error.

If DBD-mysql fails to install try installing it manually with

ppm install

Reference (bottom of page).

Putting the web application in the correct spot

For development purposes we have our web application and the parser under /Library/WebServer/Documents/ (Mac) /var/www/ (Ubuntu) and, unless you want to patch the configuration too much, we recommend that you install it there.

Move the openaustralia directory that you previously downloaded to /Library/WebServer/Documents/ (Mac) /var/www/ (Ubuntu).

# For Mac
mv openaustralia /Library/WebServer/Documents
# For Ubuntu
mv openaustralia /var/www

Fix the permissions, this is necessary so that you don’t always have use sudo when editing files or coding on the website.

# For Mac
sudo chown -R $USER:staff /Library/WebServer/Documents
# For Ubuntu
chmod -R a+rX /var/www/openaustralia


We now need to create a database in MySQL and load the schema. We assume that you have MySQL running and that your MySQL super user is root and the account has a password.

Step one. Create the database. This is pretty simple:

mysqladmin -u root -p create openaustralia
Enter password: ******

Step two. Import the schema:

mysql -u root -p openaustralia < openaustralia/twfy/db/schema.sql
Enter password: ******


Next, configure your Apache server using the example configuration files in openaustralia/twfy/conf/httpd.conf.*.
The configurations are to setup a virtual host at

You will also need to ensure mod-rewrite is enabled.


# in openaustralia/twfy/conf
cp general-example.ubuntu general
cp httpd.conf.ubuntu /etc/apache2/sites-available/


# in openaustralia/twfy/conf
cp general-example.mac general
cat httpd.conf.mac >> /etc/apache2/extra/httpd-vhosts.conf

Make sure that the name resolves to your localhost by doing the following:

echo "" >> /etc/hosts

Restart Apache to make your changes active:

sudo apachectl restart


Ensure that short_open_tag = On is set in your php.ini file.

This file is located in /etc/php5/apache2/php.ini.

Configure the web application itself

# On Mac
cp openaustralia/twfy/conf/general-example.mac openaustralia/twfy/conf/general
# On Ubuntu
cp openaustralia/twfy/conf/general-example.ubuntu openaustralia/twfy/conf/general

The configuration file openaustralia/twfy/conf/general is well documented and quite self-explanatory. It contains the configuration for MySQL (database name, host, username, etc) as well as the URL and paths for the web application on your machine.

Look at the result

You should now be able to view the results at your webserver URL,

Hopefully, you should see a working version of but without any data in it. This is because we haven’t loaded anything into the database yet. This is what we’re going to do next.

Loading data into the database

There are two alternative approaches to this:

  1. Download XML data from
  2. or setup and run the scraper / parser.

The first approach is very quick and straightforward and recommended if you are mostly interested in working on the web application.

The second approach is more time consuming but allows you to work with the scraper / parser and downloads the Hansard data from

Next: follow the install instructions for downloading XML data or follow the install instructions for setting up the parser / scraper

Keep in touch

Google Groups
Subscribe to OpenAustralia Development
Visit this group

Twitter // // Facebook // Blog

How to edit these pages