|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12481 Cookie cannot be set if there is no output for a page
Submitted: 2001-07-31 05:20 UTC Modified: 2002-06-18 18:38 UTC
From: tcmleung at yahoo dot com Assigned:
Status: Not a bug Package: IIS related
PHP Version: 4.0.6 OS: Window 2000 and IIS4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: tcmleung at yahoo dot com
New email:
PHP Version: OS:


 [2001-07-31 05:20 UTC] tcmleung at yahoo dot com
Below is code for test1.phtml
	setcookie("cokTest","test cookie",0,"/");
End of test1.phtml
Below is code for test2.phtml
	echo "CokTest : $cokTest";
End of test2.phtml

If I start to run test1.phtml, then the output is as the following:

CokTest :

It means that $cokTest cannot be set if there is no output in test1.phtml.
There is no problem in Linux-apache platform.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-11 12:23 UTC]
Dupe of #9802
 [2002-06-18 18:38 UTC]
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

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-10-17 16:00 UTC] dhemelings at hotmail dot com
This bug isn't fixed, I installed PHP 4.2.3 on a Win 2000 Server box and experience the same problem. When I try it on my Win XP machine it works.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 18 22:01:29 2024 UTC