setcookie() does not set cookie in Google Chrome

Disabling cookies for IP addresses and localhost was a design decision. See also:

Ways to work around the issue include:

  • Set a local domain (e.g., edit /etc/hosts to use
  • Use (which points to
  • Use an empty domain value when setting the cookie.

For example, in PHP:

  time() + cookie_expiration(),

Here the value null indicates that the domain should not be set.

Note: not setting the domain prevents the cookie being visible to sub-domains.

Leave a Comment