Monday, April 09, 2012

CodeIgniter - Upgrade from 1.7.x to 2.x.x - Session Reset issue

Hi you can follow instructions given at below link

Upgrade to 2.x.x


You will get stuck at session issue as session gets reset after you redirect. Redirects might be required in authentication flows.

You will face this issue particularly when you use database table "ci_sessions" to store session information.

CI upgrade have changed ci_sessions table structure in 2.x.x.

CodeIgniter - Sessions - Documentation


CREATE TABLE IF NOT EXISTS  `ci_sessions` (
session_id varchar(40) DEFAULT '0' NOT NULL,
ip_address varchar(16) DEFAULT '0' NOT NULL,
user_agent varchar(120) NOT NULL,
last_activity int(10) unsigned DEFAULT 0 NOT NULL,
user_data text NOT NULL,
PRIMARY KEY (session_id),
KEY `last_activity_idx` (`last_activity`)
);


in previous version user_data size of varchar(50), this causes session data being stored partially, and not able to retrieve it afterwords.


You just need to backup previous session table and create new ci_sessions table with above script.






No comments: