Click to See Complete Forum and Search --> : php installation = cookie problem. Anyone help?


mitya
10-16-2003, 03:09 PM
I'm trying in vain to update my practise server set-up, i.e. upgrade php, gd libraries etc. But when I install a new version of PHP, such as the one at apachefriends.org, it won't set cookies at all and so any scripts of mine requiring them fail. Does anyone know why this is so? I've checked the ini file and the 'whether to set cookies' value is set to on (1).

This is really doing my head in so any help - or info on known issues - would be appreciated.

Cheers.

eomer
10-16-2003, 04:24 PM
Couple of questions...
What version are you installing?
Windows, linux, or something else?
Is your browser except cookies? (I know I know this is like asking if your computer is plugged in....but hey anyone can overlook it :D).

I tried looking at the site that you gave (which may contain this info), but unfortunely I can't read German... er at least I think it's German. Sorry if it's not. One of these days I will know 10 languages, rule the world, and understand women. :D

mitya
10-16-2003, 05:44 PM
lol Eomer.

In answer to your questions:

1) I'm running Windows.

2) Yeap I've been using an older version of PHP/Apache for ages and had no problem with cookies. But now, if I upgrade, nothing.

3) Yes it's German but the site is also in English if you click the appropriate icon, hence my understanding.

Thanks again.

eomer
10-16-2003, 07:12 PM
Errr...oops...didn't see an icon for English. hmm. Hey I just thought you were bilingual. You know that would be cool.
ANYWAY.
I've been thinking about it a good bit, and remembered that the last time I had trouble with this it wasn't the problem of setting cookies, but calling them. Now this may not be your problem, however it is worth looking into (assuming you haven't and I'm making a fool of myself in public once again :eek: ).

Try this code:
if (!empty($_COOKIE['test']))
{
echo "The test cookie was sent by the browser\n";
}
else
{
setcookie("test", "true", time()+ 2592000);
echo "Trying to set the test cookie.<br />\n";
}

It's pretty straight forward. The first time through it SHOULD set the cookie, and then tell you that it is trying:D. The next time through it should tell you it is set.
The problem I had was simply this the cookie was coded for a direct uri...I changed it to a relative uri, and walla it fixed it.
Hope that helps...if you have already tried this...let us know...maybe someone else who has more brains and can see the english icon can help :eek: .

mitya
10-17-2003, 03:17 AM
lol Thanks Eomer, I'll try it out and report back later on.

Don't feel dumb... that's my job :)