Session persistence between multiple domains?

Is there a way to make a shared session for several domains on one server, for subdomains we use session_cookie, so I can make a shared session for subdomains.

Please, help!!!

+4
source share
2 answers

You must store the session data in the database , this is achieved by "redirecting" the save handler to your database save functions, for example

session_set_save_handler ( callback $open , callback $close , callback $read , callback $write , callback $destroy , callback $gc ) 

Callbacks are obvious. if you do a quick google search, you will find a bunch of tutorials on this subject, so you won’t have to write it from scratch. In addition, if you intend to implement your own session class, be sure to read Chriss Shiflett's article “The Truth About Sessions”

+2
source

The links below may help.

How do I support PHP sessions in multiple domains on the same server?

http://www.daniweb.com/forums/thread180252.html

The important thing is that you have to have a shared storage space for the session, to which all domains will be accessible, such as the database, as suggested by david

0
source

All Articles