title: Sharing session across multiple domains on same server in PHP
body: <p>I need to implement a solution for one of my project, where I have multiple domains + multiple sub-domains and they all need to share the same session.  All domains and sub-domains would be pointed to the single application which is connected to the single database.</p>
  
  <p>Means if user logged in from any of the domain will be able to visit secure pages of other domains of the application. User may change domain via following a link or via opening a new tab in the browser.</p>
  
  <p>I have gone through some articles and found some below mentioned solutions:-</p>
  
  <ol>
  <li><p><strong>Session in Database</strong> - What if other user from same network with same user agent hits?</p></li>
  <li><p><strong>iFrame message passing</strong> - I heard at somewhere, that iFrame renders on document load and, then checking session after showing some page content will annoy the user.</p></li>
  <li><p><strong>CURL request with CURLOPT_COOKIEFILE &amp; CURLOPT_COOKIEJAR</strong> - I have played with this and it is working fine, but don't know if it is secure and not performance killer.</p></li>
  <li><p><strong>Single Sign On (SSO)</strong> - I need some R&amp;D to implement this and it would be the last option.</p></li>
  </ol>
  
  <p>Please suggest what to do?</p>