CodeIgniter Forums
Share PHP Sessions across sub domains - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Share PHP Sessions across sub domains (/showthread.php?tid=70524)



Share PHP Sessions across sub domains - cosmo - 04-21-2018

I am trying to set up the following:

Code:
auth.domain.com
sub1.domain.com
sub2.domain.com

where if the user visits sub1.domain.com or sub2.domain.com and they are not logged in, they get pushed over to auth.domain.com and can log in. sub1.domain.com and sub2.domain.com are two separate applications but use the same credentials.

I tried setting the following in my php.ini:

Code:
session.cookie_domain = ".domain.com"

but it doesn't seem to be passing the information from one domain to the other.


RE: Share PHP Sessions across sub domains - InsiteFX - 04-22-2018

You would need to pass that information encoded to the other app.

If both domains use the same database that would be the way to go.


RE: Share PHP Sessions across sub domains - cosmo - 04-23-2018

(04-22-2018, 04:29 AM)InsiteFX Wrote: You would need to pass that information encoded to the other app.

If both domains use the same database that would be the way to go.

I was trying to avoid doing something like a query string, but it may be the best way to go after all.

Thank you.