Replies: 11 comments 16 replies
-
my php version is 7.1.19 on IIS and using database driver for session. This is my config setting:
|
Beta Was this translation helpful? Give feedback.
-
it sounds like a cookie problem. Please check both the Set-Cookie header in the first response and the Cookie header in your following requests. |
Beta Was this translation helpful? Give feedback.
-
After change $config['cookie_secure'] = FALSE; as $config['cookie_secure'] = TRUE; warning gone but session still lost after refresh. |
Beta Was this translation helpful? Give feedback.
-
I think problem is cookie value for session is changing after response. Cookie name for session is ODEME_PORTAL_COOKIE. It's request and response values are different. It must be same for no problem. |
Beta Was this translation helpful? Give feedback.
-
My session values are: |
Beta Was this translation helpful? Give feedback.
-
maybe the browser is misunderstanding the localhost context? anyway, you should look at the cookies stored in the browser after the first response is arrived (it should match the set-cookie header) and what cookie is sent in the following requests |
Beta Was this translation helpful? Give feedback.
-
There is a new step: when i use files as session driver everything works well. I think there is a session problem about database driver |
Beta Was this translation helpful? Give feedback.
-
Ok, I tested...It works, even using the database. You have some issue with your configuration. config.php: $config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_samesite'] = 'None';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = "ci_sessions";
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
$config['cookie_samesite'] = 'None'; database.php: $db['default'] = array(
'dsn' => '',
'hostname' => 'mysql',
'username' => 'myhumbleuser',
'password' => 'noneofyourbusiness',
'database' => 'ci',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => FALSE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
); table ci_sessions: CREATE TABLE IF NOT EXISTS `ci_sessions` (
`id` varchar(128) 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`)
); |
Beta Was this translation helpful? Give feedback.
-
I have exactly this same issue on moving from C1 3.1.11 to 3.1.13. Any headway with this? |
Beta Was this translation helpful? Give feedback.
-
Indeed. The question is: what are the minimum configuration settings in order to reproduce the issue? Take in mind I couldn't replicate it. It means...there's something other. Regarding the browser: have you tested on a private tab? Does the second request include the Cookie header with the session cookie inside? Please notice that I've just observed a different behaviour in Chrome with respect to localhost (but no differences between db and files). Use: $config['sess_samesite'] = 'Lax';//or strict
$config['cookie_secure'] = FALSE; |
Beta Was this translation helpful? Give feedback.
-
Hi. I started a new CI project with CI 3.1.13.
When i refresh page everything on session lost (still on database table) and new session created.
I replaced my new system/library/session folder with CI 3.1.11 (ini_set('session.id', $params['cookie_name']); tricked) and everything works without problem and session not lost.
my simple code at controller is:
when i refresh page for CI3.1.13 than NULL 123 occurs but when i load with CI3.1.11 123 123 occurs on second page load.
I test everything on stackoverflow but can't solve problem.
Beta Was this translation helpful? Give feedback.
All reactions