session_set_cookie_params(0 , '/', '.site.ru');<br>session_start();<br>
2) Rearrange the cookie after creating the session, and call its name before each session.<br>if (isset($_COOKIE['PHPSESSID'])) {<br> setcookie("PHPSESSID", $_COOKIE['PHPSESSID'], 0, "/", '.site.ru');<br> session_name($_COOKIE['PHPSESSID']);<br>} else {<br> session_start();<br>}<br>?><br>
3) Open php.ini and explicitly specify theresession.cookie_domain = '.site.ru';
The latter option will work for different sites that are not subdomains of the same server.Source: https://habr.com/ru/post/37575/
All Articles