I have 2 separate PHP apps running on the same domain server: abc.com/demo & abc.com/live
There is session_start() on almost every PHP page in both these apps. As soon as a single user interacts with the second app, the first app freezes or stops working. I think the same session ID is being used by both, which causes this conflict.
I read on PHP manual that specifying the PHP session name like
session_name("DEMO");
or
session_name("LIVE"); may help.
My question is, do I need to specify the session_name on each and every PHP page in both the apps, or is only required when the session is first created, during the login success process.
Kindly advise. Thanks.
2
Answers
"On each and every … page" is the right way.
But separate it into another script, and include that in other scripts.
Example
Because you name your sessions "DEMO" and "LIVE",
maybe place logic to decide session in a file which is shared and/or used by both apps.
If you mean that your number of PHP files and you want to access some value that is stored in the PHP session then you should session_start(); for every file
like store_session.php
home.php
home-two.php
like header.php
home.php
home-two.php