How to install and set up Kohana v3.3 – a powerful PHP framework

How to install Kohana on Windows and XAMPP

This tutorial explains how to install Kohana on Windows – an elegant HMVC PHP5 framework that provides a rich set of components for building web applications.

Key concepts about Kohana

  • Framework with a small footprint.
  • MVC approach to web development.
  • Open Source.
  • Build applications quickly.
  • Translation tools, database access, code profiling, encryption, validation, and more.
  • Use specific libraries and tools.
  • Extending existing components and adding new libraries is very easy.
  • Good debugging and profiling tools.
  • Commented code and a simple routing structure makes it easy to understand what is happening.
  • There are no code generators and endless configuration files, so setting up is fast and easy.
  • Built using strict php 5 classes and objects.

Installing Kohana – Some Diagrams

Here are the steps for the Kohana Installation on Windows 7 Ultimate Edition.

Step 1. Open the Kohana home page here and browse to the Downloads page. Download the latest stable Kohana Package. I am installing version 3.3 downloaded on Nov 20 2012. You can find the complete documentation of PHP Kohana Framework here.

PHP Kohana Framework Download
PHP Kohana Framework Download

Step 2. Unzip the package to the htdocs directory of your Web Server or extract it to a directory in your local machine and copy and paste it under htdocs.

PHP Kohana Framework Extraction
PHP Kohana Framework Extraction

Step 3. Upload the Kohana folders and files to your server. Normally the index.php file will be at your root. htdocs is the directory that the web server software (Apache) looks for files to serve on your domain. Anything you want web-viewable needs to be inside htdocs. It applies to subdomains as well. htdocs stand for HyperText Documents, which simply mean: your internet files. I have mine under D:\xampp\htdocs

kohana PHP Framework in xampp
Kohana PHP Framework in xampp

Step 4. Rename the folder for convenience. For example “kohana”

Kohana PHP Framework Rename

Kohana is now setup successfully. I have the Kohana directory structure as in the below screenshot, so that it is easy to use the urls – instead of typing http://localhost/kohana/kohana I type http://localhost/kohana

Kohana PHP Framework Installation
Kohana PHP Directory under Xampp

Try it out and Test your environment for Kohana compatibility

Point your browser to http://localhost/kohana and you will get the Welcome Screen

Kohana PHP Framework Homepage
Kohana PHP Framework Homepage

Follow up tasks for Setting up Kohana PHP Framework

Step 5. Let us now complete our Kohana Installation. Open application/bootstrap.php and make the following changes: Set the default timezone for your application.

Edit Kohana bootstrap.php
Edit Kohana bootstrap.php

Step 6. The next step is Set the base_url in the Kohana::init call to reflect the location of the kohana folder on your server relative to the document root.

Kohana bootstrap php base_url
Kohana bootstrap php base_url

Step 7. Now make sure the application/cache and application/logs directories are writable by the web server.

Test your installation by opening the URL you set as the base_url in your favorite browser.

Step 8. Once your install page reports that your environment is set up correctly you need to either rename or delete install.php in the root directory.

Kohana Install.php Delete

Once you have setup Kohana, delete Install.php

Step 9. Completing the kohana installation on windows – Kohana is now installed and you should see the output of the welcome controller:

Kohana PHP Framework Installation Complete

Online Resources

1. Kohana Discussion Forums
2. Kohana Development News
3. Video tutorial for Kohana Beginners
4. Kohana Documentation


Leave a Reply

Your email address will not be published. Required fields are marked *