0

I have several shops on 2-3 subdomains (shop1.site.com, shop2.site.com) that stores cart item data to their session 'items'.

Is it possible for me, on the main domain (site.com) to retrieve the session from example shop1.site.com?

I have tried the setting ini_set("session.cookie_domain", "shop1.site.com"); before testing with var_dump($_SESSION); but this does not work.

Karem
  • 17,615
  • 72
  • 178
  • 278

1 Answers1

0

For must users solved this issue an answer by @jeroen. As it is written here:

I just ran into the same problem and solved it setting a session name before calling session_set_cookie_params()

So try the following format:

$some_name = session_name("some_name");
session_set_cookie_params(0, '/', '.site.com');
session_start();
Community
  • 1
  • 1
Lkopo
  • 4,798
  • 8
  • 35
  • 60