Setting cookie path to "/" does not make cookie accessible to entire site

cookies, php

Solution

try including the domain parameter:

setcookie("name", "val", expire_time, "/", ".domain.com");
// don't forget the prefixing period: .domain.com

that will enable all sudomains of "domain.com"

Problem

Why when set php cookie path to "/" doesn't work for every subdirs in the domain, but just for the current directory. cookie is set like: ``` setcookie("name", "val", expire_time, "/"); ``` It just doesn't want to work.

Original source