title: How do I set a cookie on localhost with Phalcon?
body: <p>In normal PHP, to set a cookie you need to run the following code:</p>
  
  <pre><code>bool setcookie ( string $name [, string $value = "" [, int $expire = 0 [, string $path = "" [, string $domain = "" [, bool $secure = FALSE [, bool $httponly = FALSE ]]]]]] )
  </code></pre>
  
  <p>And to get it to work on localhost, string <code>$domain</code> needs to be <code>false</code>.</p>
  
  <p>To set a cookie with Phalcon, you need to run the following code:</p>
  
  <pre><code>public set (mixed $name, [mixed $value], [mixed $expire], [mixed $path], [mixed $secure], [mixed $domain], [mixed $httpOnly])
  </code></pre>
  
  <p>However, when I try and send the <code>[mixed $domain]</code> as <code>false</code> I get the following error:</p>
  
  <blockquote>
    <p>Parameter 'domain' must be a string</p>
  </blockquote>
  
  <p>Setting it to <code>''</code>, <code>null</code>, <code>'localhost'</code>, <code>'.localhost'</code>, or <code>'127.0.0.1'</code> doesn't throw an error, but doesn't save the cookie.</p>
  
  <p>The next thing my code does is <code>$this-&gt;response-&gt;redirect()</code>.</p>
  
  <p>How can I get cookies to work on localhost?</p>