PHP Fix Warning: Cannot modify header information - headers already sent...

Posted by Storm Kiernan on Stack Overflow See other posts from Stack Overflow or by Storm Kiernan
Published on 2011-02-10T07:23:19Z Indexed on 2011/02/10 7:25 UTC
Read the original article Hit count: 138

Filed under:
|
|

Warning: Cannot modify header information - headers already sent by (output started at /home/blocexco/public_html/homepage.php:73) in /home/blocexco/public_html/classes/mysql/mysql.security.php on line 99

This error is repeated a second time for mysql.security.php on line 100.

homepage:73

<div class="login">
<?php require_once 'login.php'; ?>
</div>

mysql.security.php: 99-100

      setcookie('username', "", time() - (60 * 60 * 24 * 365));
      setcookie('password', "", time() - (60 * 60 * 24 * 365));

I know this isn't a "BOM" issue as I've read about. There is output before and after my calls to header() and setcookie() functions - this is necessary since the homepage includes a php file which then injects the right login or logout form.

I've heard about using ob_start() at the beginning of content, but that's not a very specific instruction...I tried placing it at the beginning of homepage.php (just before the html tag) and that didn't fix anything.

I'm new to PHP (a few days in, and new to web-app dev in general). To be honest, it blows my mind that I can't just change which page I am on, via php without bending over backwards...

© Stack Overflow or respective owner

Related posts about php

Related posts about header