Cant set cookies
Posted by: Syndicate (---.ipt.aol.com)
Date: October 20, 2006 01:57AM

Ive just installed wamp and got my site running on localhost, but when I try to set a cookie it seems to delete it when the login script reloads to a new page.

Ive tested the script to see if its actually setting the cookie like...

$cookie_life = time() + 43200;
setcookie('ID', 1, $cookie_life);

header("Location: index.php?cookie=".$_COOKIE['ID']);

and this would output, index.php?cookie=1

I just cant seem to figure out when I try to echo the cookie on the index page it wont show.

Any suggestions? smiling smiley


Options: ReplyQuote
Re: Cant set cookies
Posted by: CyberSpatium (71.237.217.---)
Date: October 20, 2006 08:39PM

i have had similar problems like this before. this is an easy fix that worked for me. i am still not sure why it caused any problems because the setting is correct, but just never worked for me. open up your php.ini file and find:

session.save_path = "c:/wamp/tmp"

change it to:
session.save_path = "C:\WINDOWS\Temp"

save the file and restart apache for the new setting to take effect.

Options: ReplyQuote
Re: Cant set cookies
Posted by: Syndicate (---.ipt.aol.com)
Date: October 21, 2006 07:07AM

Awww I was getting so excited to see a possible fix lol

Problem is I tried the path as you suggested but still the cookie is deleted by the time I return to the new page.

Any other suggestions of php.ini fixes I might be able to try?

Thanks for the reply as its much appreciated smiling smiley

Options: ReplyQuote
Re: Cant set cookies
Posted by: CyberSpatium (71.237.217.---)
Date: October 21, 2006 12:24PM

you need to use sessions

Options: ReplyQuote


Sorry, only registered users may post in this forum.