php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51166 arning: Cannot modify header information - headers already sent by (output sta
Submitted: 2010-02-27 13:05 UTC Modified: 2010-02-27 13:19 UTC
From: chethan dot com at gmail dot com Assigned:
Status: Not a bug Package: PHP options/info functions
PHP Version: 5.3.1 OS: windowsxp
Private report: No CVE-ID: None
 [2010-02-27 13:05 UTC] chethan dot com at gmail dot com
Description:
------------
 <html>
    <head>
    <title>cookie</title>
    </head>
    <body>
    <?php
    setcookie('test',45,time()+(60*60*24*7));
    ?>    
 
</body>
    </html>


my firefox , ie8 and chrome displays

Warning: Cannot modify header information - headers already sent by 
(output started at C:\wamp\www\php_sandbox\cookies.php:7) in 
C:\wamp\www\php_sandbox\cookies.php on line 8




please help.........

Reproduce code:
---------------
---
From manual page: http://www.php.net/function.setcookie
---
<html>
    <head>
    <title>cookie</title>
    </head>
    <body>
    <?php
    setcookie('test',45,time()+(60*60*24*7));
    ?>    
 
</body>
    </html>

Actual result:
--------------
warning: Cannot modify header information - headers already sent by 
(output started at C:\wamp\www\php_sandbox\cookies.php:7) in 
C:\wamp\www\php_sandbox\cookies.php on line 8


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-27 13:19 UTC] aharvey@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Please re-read the documentation for setcookie(), which notes that you can't send any output before calling it.
 [2013-07-13 13:19 UTC] ali dot zahedi1371 at gmail dot com
what is the slotion of this warning  Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\tamrin.php:11) in C:\xampp\htdocs\tamrin.php on line 13 ????
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC