I'm running a vagrant server on my machine to test out the php side of my website.
I'm trying to use a cookie to remember an option on the site, however it is refusing to transfer to the rest of the site. I've tried specifying the local domain (test.dev), the local IP address... nothing. On the page which is called after a button click, the cookie is set:
Cookie set page:
array(3) {
["PHPSESSID"]=>
string(26) "p6rpk6ct7c9clg5fdr7j8cg4v6"
["ukshow"]=>
string(5) "hello"
["__ar_v4"]=>
string(104) "H3ELFFCLHNBXZJDXN2KICN:20140219:54|37K3GO4OMFDVHJVEKXZ7HL:20140219:54|5YST4SB55RB5LCGWF5RBRL:20140219:54"
}
Index, or any other page:
array(3) {
["PHPSESSID"]=>
string(26) "p6rpk6ct7c9clg5fdr7j8cg4v6"
["ukshow"]=>
string(0) ""
["__ar_v4"]=>
string(104) "H3ELFFCLHNBXZJDXN2KICN:20140219:55|37K3GO4OMFDVHJVEKXZ7HL:20140219:55|5YST4SB55RB5LCGWF5RBRL:20140219:55"
}
I've tried all sorts of setcookie stings, from setting the domain/ip, adding a dot before it, setting the path to /, trying quotes or single quotes... the lot. Nothing works!
An example:
setcookie("ukshow","hello",time() + (86400 * 365),"/",".test.dev");
Edit: forgot to add, I can see them fine in the developer consoles in Safari & Chrome (not checked anything else..)