title: MySIte immediately getting logged out for 2nd request
body: <p>I am new to php. I am facing problem with sessions. I mean, after I get logged in and I click on any link in the website , its immediately getting logged out. Not sure why. </p>
  
  <p>In chrome console: I entered as : document.cookie , it showing me "", then I got to understand that cookie is somehow getting deleted immediately  or some other issue. </p>
  
  <p>This problem exists for below 2 websites.</p>
  
  <p>We have a websites like :</p>
  
  <pre><code>www.mysite.site1.com/folder1
  www.mysite.site2.com/folder2
  </code></pre>
  
  <p><strong>Below is my code of MySite.com/folder1</strong> </p>
  
  <pre><code>   function MySession() {
        $params = session_get_cookie_params();
        session_set_cookie_params($params['lifetime'], '/v/folder1');
        session_start();
     }
  
     function clear()
     {
        $_SESSION=array();
        session_destroy();
     }
  </code></pre>
  
  <p><strong>Below is my code of MySite.com/folder2</strong> </p>
  
  <pre><code> function MySession() {
        $params = session_get_cookie_params();
        session_set_cookie_params($params['lifetime'], '/v/folder2');
        session_start();
     }
  
     function clear()
     {
        $_SESSION=array();
        session_destroy();
     }
  </code></pre>