Cookie problem

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
tengue17
Forum Newbie
Posts: 8
Joined: Tue Jul 11, 2006 1:16 am

Cookie problem

Post by tengue17 »

Hello everyone,
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";
 }
?>
and then check it with another script:

Code: Select all

<?php
print_r($HTTP_COOKIE_VARS);
?>
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.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Please do not double post. Your original thread.. viewtopic.php?t=51411
Post Reply