PHP Sessions across sub domains

User will  login or set sessions at and can use that session all the sub domains of that domain. the session will use across all sub domains.
where if the user visits or and they are not logged in, they get pushed over to and can log in. and are two separate applications but use the same credentials.

To solve this problem, we can use the code below::

$some_name = session_name("some_name");
session_set_cookie_params(0, '/', '');

No need to Change in php.ini file


Note:: If you find the better solution please comment below..

Leave a Reply

Your email address will not be published. Required fields are marked *