I have such a problem.
On the main domain.com domain created a cookie:

setcookie ("webmID", $_GET['webmID'], time()+7*24*60*60, "/", ".domain.com"); 

On the sub domain sub.domain.com, this cookie is displayed normally, but for some reason it cannot be deleted. I tried:

 setcookie("webmID", "", time()-3600); setcookie("webmID", "", time()-3600, "/"); setcookie("webmID", "", time()-3600, "domain.com"); unset($_COOKIE['webmID']); 

Can not delete.
Help me please

  • So you tried? setcookie ("webmID", "", 1, "/", ".domain.com"); About time()-3600 can be read [here] ( habrahabr.ru/post/146109 ). - ReinRaus

1 answer 1

Here so try

 setcookie ("webmID", "", time()-7*24*60*60, "/", ".domain.com"); 

In general, it is better to set cookies like this

 setcookie ("webmID", $_GET['webmID'], time()+7*24*60*60, "/", $_SERVER['HTTP_HOST']."любой поддомен"); 

Then with multiple domains of the site there will be no errors.