Initial setup of a Kohana project
Everybody has to start some where so why not here. I love Kohana but I was frustrated to get started with it. I wanted to know what the best practice was to set up a kohana project and after some time in the forums I got the answers I needed, so here’s what I found.
Download
Firstly download either the stable release or the latest from SVN. If your going to be creating your own subversion repository for your Kohana project and your downloading the latest build from SVN then I suggest you use “export” instead of the “checkout” svn command as it retrieves everything but doesn’t include any of the Kohana .svn files.
Structure
Your Kohana download consists of three folders (application, modules and system) a PHP page (index.php) and some images. The system folder is the guts of Kohana, it contains all the core classes of the framework. Modules contains extensions to the framework to provide extra functionality such as authentication, unit testing, etc. Finally the application folder is where your web application lives. Any code you write will be stored in here.
Best practice is to keep as much as possible out of your webroot. With this in mind only copy the PHP file (index.php) in here. Move the other three folders to the same level as your webroot. So your directory structure looks as follows:
- application/
- modules/
- system/
- webroot/ index.php
Configuration
Open the index.php and edit the $kohana_application, $kohana_modules and $kohana_system variables to point to their directory locations e.g. $kohana_system = “../system”;
Open application/config/config.php, find the line $config['site_domain'] and set to equal to your site domain, e.g. $config['site_domain'] = ‘localhost’;
Finally don’t forget to give read/write permissions on the application/logs directory for the user process (cli chmod in lunix and right-click in windows).
That’s it, your now ready to start coding your application. Enjoy and good luck. ![]()
July 31st, 2008 at 7:48 pm
Good post BennyTheMink! Very useful for the compilation I’m making.
for reference purposes I will include this link from the official docu, useful as it has instructions for setting up KF for multiple sites…
http://docs.kohanaphp.com/installation