title: Passing PHP session from one directory to another created parallely in public_html
body: <p>i have 3 basis directories in <code>public_html</code> directory. For example these are:</p>
  
  <ol>
  <li>Directory_A  represents <a href="http://site.com" rel="nofollow noreferrer">http://site.com</a></li>
  <li>Directory_B  represents <a href="http://subsite-b.site.com" rel="nofollow noreferrer">http://subsite-b.site.com</a></li>
  <li>Directory_C  represents <a href="http://subsite-c.site.com" rel="nofollow noreferrer">http://subsite-c.site.com</a></li>
  </ol>
  
  <p>i have another directory in <code>public_html</code> named <code>Sessions</code> where i want to save the <code>sessions cookies</code> when logged users visit across the directories (site and sub-sites)</p>
  
  <p>the attached picture demonstrated my directory structure clearly in <code>cPanel.</code></p>
  
  <p><img src="https://i.stack.imgur.com/INqAx.png" alt="Directory Structure"></p>
  
  <p>i face no problem to pass session between the folders and sub-folders in <code>Directory_A</code>. the problem appears when visitors switch from  <code>Directory_A</code> to <code>Directory_B</code> or <code>Directory_C</code> (visit from <a href="http://site.com" rel="nofollow noreferrer">http://site.com</a> to <a href="http://subsite-b.site.com" rel="nofollow noreferrer">http://subsite-b.site.com</a> or <a href="http://subsite-c.site.com" rel="nofollow noreferrer">http://subsite-c.site.com</a>) sessions are not passed at all although i set the variable <code>session_set_cookie_params</code>in every page of the above stated sub-sites like,</p>
  
  <pre><code>$mysession = session_name("mysession");
  session_set_cookie_params(0, '/', '.site.com');
  session_start();
  </code></pre>
  
  <p>notable thing is that presently the variable <code>session.save_path</code> has the following configuration on my <code>PHP</code> server.</p>
  
  <pre><code>session.save_path   /tmp    /tmp
  </code></pre>
  
  <p>now, as the sessions aren't passed at all from one directory to another directory in <code>public_html</code>, i changed the configuration of <code>session.save_path</code> by pointing the path to  <code>public_html/Sessions</code>like,</p>
  
  <pre><code>session.save_path   /public_html/Sessions   /public_html/Sessions
  </code></pre>
  
  <p>the above change in configuration returns following similar warning in every page of <a href="http://site.com" rel="nofollow noreferrer">http://site.com</a> , <a href="http://subsite-b.site.com" rel="nofollow noreferrer">http://subsite-b.site.com</a> and <a href="http://subsite-c.site.com" rel="nofollow noreferrer">http://subsite-c.site.com</a> when visitors visit these sites.</p>
  
  <pre><code>Warning: session_start() [function.session-start]: open(/public_html/session/sess_0d38g21b3153bb4343g8d687442e76ed, O_RDWR) failed: No such file or directory (2) in /home/user/public_html/Directory_B/index.php on line 4
  </code></pre>
  
  <p>on line 4 as stated in the above warning i've got the code <code>session_start();</code></p>
  
  <p>what's going wrong here? is it happening because of improper server configuration? what should i do to pass the sessions properly from one directory to another directory?</p>
  
  <p>any idea or knowledge about this issue shall be well appreciated.</p>