i cannot find the sess_use_database on my config.php in code igniter.this are the only codes that
https://stackoverflow.com/questions/35125229/no-sess-use-database-in-config-php-code-igniter
0
i cannot find the sess_use_database on my config.php in code igniter.
this are the only codes that i have.
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
do i have to add the sess_use_database, or there is another way of accessing it.
php codeigniter session
shareimprove this question
asked Feb 1 '16 at 7:40
kev_m
167218
add a comment
1 Answer
active oldest votes
-1
For using database session change session_driver to 'database'
$config['sess_driver'] = 'database';
$config['sess_expiration'] = 7200;
// Table name ci_sessions
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = TRUE; // I use true
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
SQL
CREATE TABLE IF NOT EXISTS `ci_sessions` (
`id` varchar(40) NOT NULL,
`ip_address` varchar(45) NOT NULL,
`timestamp` int(10) unsigned DEFAULT 0 NOT NULL,
`data` blob NOT NULL,
KEY `ci_sessions_timestamp` (`timestamp`)
);
Then autoload session
$autoload['libraries'] = array('session');
If you choose to use files session:
Create a session path example: FCPATH . 'applcation/cache/ or create own folder if your using files. In the application folder when make your new session storage folder has chmod 700 permission
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = FCPATH . 'applcation/cache/';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
Then autoload session
$autoload['libraries'] = array('session');
Last updated
Was this helpful?