php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12540 setcookie doesn't work!
Submitted: 2001-08-03 00:20 UTC Modified: 2002-06-03 12:13 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:2 (100.0%)
From: blueeye at mail dot blueeye dot idv dot tw Assigned:
Status: Not a bug Package: IIS related
PHP Version: 4.0.6 OS: win2k
Private report: No CVE-ID: None
 [2001-08-03 00:20 UTC] blueeye at mail dot blueeye dot idv dot tw
I've tried my project on 2 PCs with OS win2k pro and win2k server which run IIS + 4.0.5/4.0.6, but function setcooke() 
doesn't work!
setcooke worked fine on IIS + php 4.0.0 half a year ago.
but now I can't use it on IIS + php 4.0.6.

may somebody help me test it? thanks a lot.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-03 08:41 UTC] andy@php.net
please include a sample script, or create a script like this one
and put it on the internet...

<?
setcookie("test","testing");
phpinfo();
?>
 [2001-08-03 08:52 UTC] andy@php.net
never mind, submitted twice.
 [2001-08-03 09:37 UTC] blueeye at mail dot blueeye dot idv dot tw
I was so surprised that people replied my post so soon.
thanks Andy. ( btw, sorry for my poor english.)

well. I used your code below and save the output.
I put it on http://www.blueeye.idv.tw/info.htm
please help me check it. thanks again.

I've work with php for over 2 years. but this is my 
second time used it in IIS. this problem really confuses me.
thanks all the zealous man!
 [2001-08-03 09:41 UTC] andy@php.net
status -> open
 [2001-08-03 09:44 UTC] andy@php.net
how about doing this...

create a script like this

<?
setcookie ("test","testing");
echo "wahoo";
?>

then open an MS-DOS prompt, and type

php c:\the\path\of\the\script.php

look at the HTTP headers, is there a Cookie: header?
 [2001-08-03 10:15 UTC] blueeye at mail dot blueeye dot idv dot tw
yes, I can see set-cookie statment in html header.
(it seems reasonable)
but no cookie saved. (I check this by many ways,
even no related cookie saved in cookie directory)

I discribe my install action by detail.
I installed IIS, and unzipped php-4.0.6-win32.zip into some directory.
I did some config: added exetend filename '.php' and executive file 'c:\path\php.exe'.
I renamed php.ini-dest to php.ini
(only add zend optimizer config into php.ini, but it didn't matter)
I copyed php.ini into c:\winnt
restart IIS of course.

all php pages are works perfectly without setcookie function.

I tried some of my coworkers' computer (win2k+iis), but all the same.

thank you again. if my situation is a weird case, and makes you impatient, please don't blame on me and stop this 
post! otherwise, I would like you to help me. thanks.



 [2001-08-03 10:26 UTC] blueeye at mail dot blueeye dot idv dot tw
oh, I read some post in bug reporting. I found my case and  cookie test pages are familiar like post #12481. and my 'big' project which want to migrate to IIS is the same too.

test page like this
1) test1.php
<? setcookie('test1', 'teststring');
   header('location: test2.php');
   exit;
?>
2) test2.php
<? echo "test2 = $test2"; ?>


 [2001-08-03 10:49 UTC] blueeye at mail dot blueeye dot idv dot tw
according to the post #9802, I think setcookie function
can't work fine in IIS5 + win2k.

this may be IIS5 bug!
but I hope php dev team or IIS can fix this.

I used apache + (freebsd/dec/win2k) before, setcookie works fine. but IIS5 ....

 [2002-06-03 12:13 UTC] mfischer@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately your version of PHP is too old -- the problem
might already be fixed. Please download a new PHP
version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 [2002-06-11 05:00 UTC] blueeye at mail dot blueeye dot idv dot tw
I have to say sorry again.
Nowaday I use PHP 4.2.1 + Apache 1.3.24 in win2000.
SetCookie fuction works fine.

BUT under PHP 4.2.1 + IIS 5 in win2000.
"Everything" is good but SetCookie....
I mean seriously "Everything" but SetCookie.
Of course, I used some PCs to test all the cases.

thanks for your comments.
 [2002-06-11 05:05 UTC] blueeye at mail dot blueeye dot idv dot tw
Does anybody else find that SetCookie in IIS 5 doesn't work?
I can't believe that.
Please have a trial.
thank you.
 [2002-07-12 05:57 UTC] moby dot lin at msa dot hinet dot net
i have the same problem.

<?//this doesn't work.
setcookie("aa","bb",0);
header("Location: test2.php");
?>

<?//this work fine.
setcookie("aa","bb",0);
echo "xxxxxxx";
?>
 [2002-07-12 05:58 UTC] moby dot lin at msa dot hinet dot net
my platform:
w2k server + php4.2.1
 [2003-05-20 07:26 UTC] john dot g at envent dot co dot za
I have the same problem - also running on IIS 5.0 on a Win2k box - if I call setcookie () and then header ("Location: ..."), the cookie is not returned. Any ideas?
 [2003-05-20 08:36 UTC] john dot g at envent dot co dot za
Never mind... <sigh!> found the answer:

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q176/1/13.ASP&NoWebContent=1
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Oct 09 23:01:26 2024 UTC