php - access session by subdomains -


Hello I have a problem reaching a session on a subdomain This code will be set on domain.com using this code

  & lt ;? Php ob_start (); Ini_set ("session.cookie_domain", "domain.com."); Session_start (); Header ("content-type: text / html; charset = UTF-8"); ....   

By adding a point to the domain, possibly a session should be set for the subdomain.

This line was found on phpinfo wwhere:

  session.cookie_domain does not value any value   

Because of hosters setting, There is no chance to edit .ini file. So I had to add the ini_set line in all the files like above.

The problem is the following: A session will be set when I call domain.com. I have created a test page that easily unites sessions and cookies as I said the session will be set to domain.com and when I call at domain.com/testfile.php, it will be shown correctly . But when I will call at www.domain.com/testfile.php, then the cookie will appear, but the session is not empty, it is empty there also has added the ini_set line at testfile.php.

So I do not have any clue why does not it work? I have removed cache and browser history many times but nothing can change. I also tried differnt browsers.

If there is someone who can give me a signal I really appreciate.

Thanks a lot.

You have to start the session first. So this will work

     

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -