In Kohana 3, Setting up server environment

When the website is under development (usually in local) the environment need to be set as ‘development’.. and whereas when you published the website to access by others (usually visible to public) need to be set as ‘production’.

Technique using .htaccess file
For development: In your .htaccess file of your local computer, set environment variable as..

SetEnv KOHANA_ENV development

For production: In your .htaccess file of your live server, set environment variable as..

SetEnv KOHANA_ENV production


Kohana’s bootstrap file will detect this server variable automatically and your server environment is set. Below lines already exist in your application/bootstrap.php

if (isset($_SERVER['KOHANA_ENV']))
{
	Kohana::$environment = constant('Kohana::'.strtoupper($_SERVER['KOHANA_ENV']));
}

This way you can set other sever environments such as.. testing, staging in Kohana.