Hi All!
Found this on the archives. I couldn't find a satisfactory solution response though. I'm encountering the same problem on IIS 4 and PHP4 when I migrated from Apache and PHP4.
setcookie("username", "pat", 0);
setcookie("password", "pat", 1);
works on the linux version but nothing comes out on the $username and $password in the IIS version.
I'm wondering if I should tweak IIS 4.0 or the php.ini.
Hope you guys can help. Thanks!
Author: Michael R
Date: 2000-06-28 09:26:12
Subject: setcookie problem on new server
The problem is, I've been developing this site for a couple of months on NT (PHP3.0.16 & IIS). I use cookies to track the user. In preparation for moving the site to the production server, I tested it on a Linux system with PHP4 & Apache (don't know what version). On both the development and test servers, the cookies worked fine. Now, on my development server, it doesn't work on IE! The production server is PHP3 and Apache.
The code for setcookie is:
// Begin Code
setcookie("user_name", $user, (time()+TIME_OUT), "/vet/", "www.myserver.com", 0);
setcookie("user_hash", $hash, (time()+TIME_OUT), "/vet/", "www.myserver.com", 0);
setcookie("user_id", $arArray["uID"], (time()+TIME_OUT), "/vet/", "www.myserver.com", 0);
echo "" .
"" .
"";
exit;
// End code
The variables are set correctly prior to calling setcookie, TIME_OUT is a constant defined to 1200 (20 minutes). I have also tried this without the last three parameters, that didn't work. Also with "/" as the directory. Would different versions of Apache and PHP have anything to do with it? I don't see what else would be causing the problem.