title: PHPSESSID Cookies on Sub-domains are having conflicts with each other
body: <p>We are having some issues with PHP Session Cookies not allowing us to log into our *SugarCRM**  application which is open source PHP application.</p>
  
  <p>The problem is we have the same application installed on 2 sub-domains like below...</p>
  
  <p><strong>Main site</strong><br>
  <code>www.domain.com</code></p>
  
  <p><strong>Dev site</strong><br>
  <code>dev.www.domain.com</code></p>
  
  <p>Now after logging into one, it will not allow you to login to the other!  </p>
  
  <p>Please view the image below to see the Cookie problem...</p>
  
  <p><img src="https://i.stack.imgur.com/TSEKn.png" alt="enter image description here"></p>
  
  <p>In the image above you can see that there is 2 PHPSESSID Cookies competing for the Session!</p>
  
  <p>If I now delete one of them, it allows me to login as normal without an issue!</p>
  
  <p>Because this is SugarCRM, I am hoping I can resolve this issue without making really any core file modifications to the application.  But if I have to, then we will.</p>
  
  <p>So does anyone have any ideas on a good solution?</p>
  
  <p>Right now my idea for a "Nasty Dirty Hack" which I really do NOT want to have to do.  It is to make a button on the login form, this button will use JavaScript to clear/delete the <code>PHPSESSID Cookies</code> but again I would really like to find a proper solution.</p>
  
  <p>If anyone has any ideas, please share?  Thank you</p>
  
  <hr>
  
  <p><strong>UPDATE</strong><br>
  Thanks for the answers so far.  Please do take into acocunt that this is not a simple PHP application that I built where I can easily do code changes.  THis is SugarCRM which is a massive large application with thousands of files</p>