title: Unable to Set Cookie Expiration Time on LocalHost
body: <p>I am writing a cookie and trying to set the expiration time in my localhost. However, it is always showing Ending time as "When browsing session ends"</p>
  
  <p>Here is the code</p>
  
  <pre><code>$domain = ($_SERVER['HTTP_HOST'] != 'localhost') ? $_SERVER['HTTP_HOST'] : false;
  setcookie('rememberme', $cookie, time()+86400*7, '/', $domain, false);
  </code></pre>
  
  <p>Can someone please help me on why I am facing this issue?</p>
  
  <p><img src="https://i.stack.imgur.com/DiCkl.png" alt="enter image description here"></p>
  
  <p>This is causing my cookie to get destroyed every time I close my browser.</p>