Subdomain loading a CodeIgniter session

I have 2 installations of CodeIgniter, 1 on mydomain.com another on sub.mydomain.com.

I am trying to get sub.mydomain.com to be able to access the CI session created by mydomain.com. I edited the cookie section of both configuration files:

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

Now, if I go to configure mydomain.com session and then go to sub.mydomain.com, it seems to rewrite the session with a new one and not be able to read from the existing session.

Am I missing something?

+1
source share
1 answer

It drove me crazy for several hours, but the solution (as usual) was simple. I forgot to make sure that

 $config['encryption_key'] 

was the same for both applications!

Works great now

+2
source

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


All Articles