For eg
App.1
session_start();
$_SESSION["user_name"] = "xyz";
$_SESSION["is_login"] = True;
'''''''''''''''''''''''''''''''''''''''''''''''
App.2
session_start();
$_SESSION["user_name"] = "abc";
$_SESSION["is_login"] = false;
How to use same session like above same session for different application at same time?
Call the session_name function passing in an identifier for your app prior to calling session_start
For example
session_name("App1");
session_start();
I would do like this:
$_SESSSION['current_app'] = 'app1';
App.1
session_start();
$_SESSION['app1']["user_name"] = "xyz";
$_SESSION['app1']["is_login"] = True;
'''''''''''''''''''''''''''''''''''''''''''''''
App.2
session_start();
$_SESSION['app2']["user_name"] = "abc";
$_SESSION['app2']["is_login"] = False;
To retrieve the current session:
$current_app = $_SESSSION['current_app'];
$user_name = $_SESSION[$current_app]["user_name"]
$is_login = $_SESSION[$current_app]["is_login"]
You could of course use session_name() as Orangepill stated, but then you will have to consider some things: (Based on reading the comments from session_name() - manual - http://php.net/manual/en/function.session-name.php)
Have different session names ,that would be good.
You can use different session in a single application. For that you need to set you session_cookie_path differently for different session.