Update: The Kohana framework has been deprecated and the last stable version was 3.3.6 released on 25 July 2006.

I’m starting on something completely new to me: the Kohana framework, and this is my attempt to document everything I’m learning. When I started this blog, I was already one year into Drupal, and so a lot of the things I struggled with as a noob had more or less evaporated from my mind. For Kohana, I’m a complete noob once again, so hopefully this will be helpful to somebody who’s starting from zero as well.

As of time of writing, the latest stable version of Kohana is v3.3.3.1. There are 2 ways to install Kohana on your system, either download the .zip file from the homepage or get the files via git. If you choose the first option, extract the contents of the .zip file into your local web root. If you choose the second option, navigate to your local web root and run the following:

git clone git://github.com/kohana/kohana.git
cd kohana/
git submodule init
git submodule update

Note: If you need to use a version of Kohana other than the latest stable version, you can try downloading it from the archives, but the last I tried, the archives were offline. Your best bet is to get it from Kohana’s GitHub repository.

For installation via git, there is an extra step to switch git branches if you need an earlier version.

git clone git://github.com/kohana/kohana.git
cd kohana/

To see all the branches, run the following:

git branch -a

Git branch list

For example, if you need v3.0, run:

git checkout 3.0/master

Once you're on the version branch of your choice, run:

git submodule init
git submodule update

Open the bootstrap.php file in the application folder. There are a couple of things to change in this file.

  1. Update your default timezone.

  2. Update the base_url to point to your site installation.

         'base_url'   => '/kohana3/',
  3. Enable modules.

         'auth'       => MODPATH.'auth',       // Basic authentication
         'cache'      => MODPATH.'cache',      // Caching with multiple backends
         'codebench'  => MODPATH.'codebench',  // Benchmarking tool
         'database'   => MODPATH.'database',   // Database access
         'image'      => MODPATH.'image',      // Image manipulation
         'orm'        => MODPATH.'orm',        // Object Relationship Mapping
         'oauth'      => MODPATH.'oauth',      // OAuth authentication
         'pagination' => MODPATH.'pagination', // Paging of results
         'unittest'   => MODPATH.'unittest',   // Unit testing
         'userguide'  => MODPATH.'userguide',  // User guide and API documentation

If you navigate to the site root from your browser, you should see this:

Environment ready

You need to adjust the permissions on the cache and logs folders. From your terminal, navigate to the application folder and run the following:

sudo chmod 777 cache/ logs/

Refresh the page and you should now see:

Initial screen

Delete the install.php file from the root folder via your favourite method. I just use:

rm install.php

Now, when you refresh the page, you should see a hello, world! message. We now have a fresh Kohana site on our hands to play with.