Setcookie Not Working

if you have a setcookie code like this one

setcookie("somecookie", $somevar, time()+3600000,'/','.yourdomain.com');

and you can’t figure out why its not saving the cookie the most likely reason is that you are outputting
some whitespaces or some characters before the setcookie

so if you have
code like this

include("somefile.php");
setcookie ....

then you should check whether somefile is not outputting some characters and go to the last line of the file and see if there are whitespaces after the php close tag
?>



This entry was posted in PHP MYSQL LINUX DNS and tagged , . Bookmark the permalink.