Sharing session data for all subdomains

I am trying to use data sessionfor all my subdomains.

I created subdomainin the cpanelfollowing way:*.mydomain.in

and mine *.mydomain.inuses the same path as my example mydomain.in:

mydomain.in uses the path on my server: /public_html/mydomain.in

*.mydomain.in uses the path on my server: /public_html/mydomain.in

Now the problem is every time I visit the site, creating another session. For instance:

I attend mydomain.in.... he creates a session.

I attend example.mydomain.in.... he creates another session

I visit again mydomain.in... he creates another session.

my codeigniter configfile:

$config['encryption_key'] = 'MY-SECRET-KEY-HERE';

$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'] = TRUE;
$config['sess_time_to_update'] = 300;

$config['cookie_prefix'] = "";
$config['cookie_domain'] = ".mydomain.in";
$config['cookie_path'] = "/";
$config['cookie_secure'] = FALSE;

Any help or suggestion would be a big help. Thanks in advance.

+4
1

.

 $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'] = "etc_anything_";
 $config['cookie_domain'] = ".mydomain.in";
 $config['cookie_path'] = "/";
 $config['cookie_secure'] = FALSE;
+10

Source: https://habr.com/ru/post/1533037/


All Articles