#19063 [Fbk->Opn]: Can't set any cookie. Received error warning about header.

From: Date: Fri, 23 Aug 2002 14:50:11 +0000
Subject: #19063 [Fbk->Opn]: Can't set any cookie. Received error warning about header.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-17661@lists.php.net to get a copy of this message
ID: 19063 User updated by: h_tr_dung@hotmail.com Reported By: h_tr_dung@hotmail.com -Status: Feedback +Status: Open Bug Type: HTTP related Operating System: WinXP Pro. and FreeBSD 4.6 PHP Version: 4.2.2 New Comment: Thanks rasmus, Below are the links: Test file: http://vietecon.com/php/Test_Cookie.php SetCookie file: http://vietecon.com/php/setcookie.php Source codes in ZIP http://vietecon.com/php/cookie.zip Domain vietecon running FreeBSD 4.6, Apache/1.3.26 (as I described). P.S. Sorry to sniper if my tone was harsh to you. Previous Comments: ------------------------------------------------------------------------ [2002-08-23 10:32:55] rasmus@php.net It is very very unlikely that there is a PHP bug here. You probably have something before the opening <?php tag in the file that sets the cookie. Put up a .phps or a .zip file somewhere with the actual files in question so we can have a look. And when we do explain your mistake to you, you can apologize nicely to sniper. ------------------------------------------------------------------------ [2002-08-23 10:11:47] h_tr_dung@hotmail.com My code has nothing wrong (as you can see)! This was a bug and I reported it. However, I guess I should have done it with an aggresive tone to get more attention from you. Cheer ------------------------------------------------------------------------ [2002-08-23 07:15:40] sniper@php.net Sorry, but the bug system is not the appropriate forum for asking support questions. Your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php Thank you for your interest in PHP. ------------------------------------------------------------------------ [2002-08-23 03:38:27] h_tr_dung@hotmail.com I have tested the "baking" file (please see below) in two machines and received the same error: Warning: Cannot add header information - headers already sent by (output started at ...\setcookie.php:1) in ...\setcookie.php on line 2 The first system used: WinXP Pro., IIS (built-in with WinXP). The second system used: FreeBSD 4.6, Apache/1.3.26. The "baking" file's content: <?php setcookie ("Chip_Name",$Chip); echo "<BODY OnLoad=\" location='".$forwarding."' \">"; ?> The test file's content: <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <?php echo $Chip_Name; ?> <a href="setcookie.php?Chip=Chocolate&forwarding=<?php echo $PHP_SELF ?>">Test SetCookie() Function</a> </body> </html> Is it a bug?!? Or there is something wrong with my code?!? I couldn't even "bake" any cookie because some headers were sent first, but how could? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19063&edit=1

« previous php.bugs (#17661) next »