title: Setting a cookie for a parent domain
body: <p>I am building an application using PHP and I came with this problem. I have the main domain and a subdomain called API. The domain contains my index php file and the website itself. The subdomain "api" makes all the requests for my app. It's like a Model-View-Control framework. The problem is I am setting a new cookie inside the api domain and it is not available on the parent domain. I am using this:</p>
  
  <pre><code>setcookie('name','value', time() + 3600, '/');
  </code></pre>
  
  <p>How can i solve this? Also I have tried to set the "path" parameter to 'domain.com' but it still doesn't work. </p>