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

Continue reading “In Kohana 3, Setting up server environment”

In Kohana 3, Save session in database

Session usage for native or database adapter is same. Just follow the below 2 steps on saving database session and you’re done.

1] Create database-based session table:

CREATE TABLE IF NOT EXISTS `sessions` (
	`session_id` VARCHAR( 24 ) NOT NULL,
	`last_active` INT UNSIGNED NOT NULL,
	`contents` TEXT NOT NULL,
	PRIMARY KEY ( `session_id` ),
	INDEX ( `last_active` )
) ENGINE = MYISAM ;

Continue reading “In Kohana 3, Save session in database”