S
S
sllugovskih2016-08-15 13:16:51
MySQL
sllugovskih, 2016-08-15 13:16:51

Why doesn't CodeIgniter session work on subdomains?

There is a project on CodeIgniter 3.1.0. Session variables are not saved when moving from subdomain to subdomain of the site. That is, logged in to novosibirsk.site.ru, go to moskva.site.ru and the session is reset, but when we return to the first subdomain, the user remains logged in there.
Settings:
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 0;
$config['sess_expire_on_close'] = TRUE;
$config['sess_encrypt_cookie'] = TRUE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = TRUE;
$config['sess_match_useragent'] = FALSE;
$config['sess_time_to_update' ] = 300000000;
$config['cookie_prefix'] = "mysite";
$config['cookie_domain'] = ".mysite.com";
$config['cookie_path'] = "/";
$config['cookie_secure'] = FALSE;

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sllugovskih, 2016-08-15
@sllugovskih

Solution for version 3.1.0:

$config['sess_driver']     		= 'database';
$config['sess_cookie_name']     = 'sitename';
$config['sess_save_path']      = 'ci_sessions';
$config['sess_match_ip']        = TRUE;
$config['cookie_prefix']	= 'sitename_';
$config['cookie_domain']	= '.sitename.com';
$config['cookie_path']		= '/';
$config['cookie_secure']	= FALSE;
$config['cookie_httponly'] 	= FALSE;

D
Denis, 2016-08-15
@ziffyweb

Mb sess_expire_on_close make FALSE ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question