Cookie problem
Posted: Wed Jul 12, 2006 2:47 am
Hello everyone,
I have a very weird problem, with my WAMP machine:
i set cookie using
and then check it with another script:
In 2 different machine.
the first machine is a win2k, Apache 2, php5.
It worked but only thru localhost. if i accessed it thru the 2nd machine, print_r gives me empty array.
In the second machine with winXP, i installed PHPTriad 2.2, containing apache1.3 and php4.1.
It worked thru localhost, and also thru machine1 via local network. perfect...
Then i copied the whole apache folder containing apache1.3 itself, php4.1, and the settings from the 2nd machine to the first machine. Stopped Apache2, run apache1.3, and execute the code. The same problem persists.
Then i modified httpd.conf ServerName with its ip address, set ServerAlias, I also tried $_COOKIE instead, still no luck. What's the problem?
Please help, i've been trying to figure it out for 3 weeks now. Thanks in advance.
I have a very weird problem, with my WAMP machine:
i set cookie using
Code: Select all
<?php
$ret = setcookie('username', 'admin', mktime()+120, '/');
if (!ret) {
echo "unable to set cookie";
}
else {
echo "cookie is set";
}
?>Code: Select all
<?php
print_r($HTTP_COOKIE_VARS);
?>the first machine is a win2k, Apache 2, php5.
It worked but only thru localhost. if i accessed it thru the 2nd machine, print_r gives me empty array.
In the second machine with winXP, i installed PHPTriad 2.2, containing apache1.3 and php4.1.
It worked thru localhost, and also thru machine1 via local network. perfect...
Then i copied the whole apache folder containing apache1.3 itself, php4.1, and the settings from the 2nd machine to the first machine. Stopped Apache2, run apache1.3, and execute the code. The same problem persists.
Then i modified httpd.conf ServerName with its ip address, set ServerAlias, I also tried $_COOKIE instead, still no luck. What's the problem?
Please help, i've been trying to figure it out for 3 weeks now. Thanks in advance.