Rejoanul Alam Rejoanul Alam - 5 months ago 13x
PHP Question

Access subdomain session from main domain

I have an application in I want user will be redirected to when login to, however session successfully generating in a directory at Now my problem is after submit login, users are not able to login Although there are session files are available.

Session driver is file ( config file)

$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 0;
$config['sess_save_path'] = 'mydir/application/session_data';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 0;
$config['sess_regenerate_destroy'] = FALSE;

My application working fine in local server. But not working in production.


You also have to set the cookie_domain and cookie prefix in your config file like this

$config['cookie_prefix'] = "mydomain_";
$config['cookie_domain'] = "";
$config['cookie_path'] = "/";
$config['cookie_secure'] = FALSE;