Support Forums

Full Version: Cannot Modify Header Information Error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello People, All members of my site have been randomly getting this error:


Warning [2] Cannot modify header information - headers already sent by (output started at /home/alliance/public_html/forums/index.php:1) - Line: 1541 - File: inc/functions.php PHP 5.2.9 (Linux)
File Line Function
[PHP] errorHandler->error
/inc/functions.php 1541 header
/inc/class_session.php 106 my_setcookie
/global.php 56 session->init
/index.php 19 require_once

It's not happening always. It's only on Index page and sometimes It loads fine without errors, but sometimes it displays the error above.

I would like to know what does this mean and how can i fix it.

Thanks in advance!
Take a look at the default index.php & inc/functions.php and see how yours is different. That will be why you're getting an error.
Thanks iBruteforce, i'll check if you are right.
Usually this is because data is sent to the browser before the script is executed properly. You can check to see if any characters exist before php is initiated and headers sent.

<?

There should not be anything before that line. Not even a space.


You can try to upload the files included in the error from a fresh mybb download. You may have corrupted a file during an edit.
I've checked both Functions.php and Index.php of my board and the default one's and didn't see anything different. However, recently I have screwed the footer of my theme, so I have copied and pasted the footer of default MyBB Theme. Maybe this could cause the problem?


I don't really see anything that could cause it, however here's the footer :

Code:
<br />
<br />
<div align=center><img src="Censored"></img></div>
            <br />
<br />
<br />
<br />
            <div class="bottommenu">
                <div class="float_right">{$lang_select}</div>
                <div>
                    <span class="smalltext"><a href="{$mybb->settings['contactlink']}">{$lang->bottomlinks_contactus}</a> | <a href="{$mybb->settings['homeurl']}">{$mybb->settings['homename']}</a> | <a href="#top">{$lang->bottomlinks_returntop}</a> | <a href="#content">{$lang->bottomlinks_returncontent}</a> | <a href="<archive_url>">{$lang->bottomlinks_litemode}</a> | <a href="{$mybb->settings['bburl']}/misc.php?action=syndication">{$lang->bottomlinks_syndication}</a></span>
                </div>
            </div>
            </div>
        <hr class="hidden" />
            <div id="copyright">
                <div id="debug"><debugstuff></div>
                <!-- MyBB is free software developed and maintained by a volunteer community.
                     It would be much appreciated by the MyBB Group if you left the full copyright and "powered by" notice intact,
                     to show your support for MyBB.  If you choose to remove or modify the copyright below,
                     you may be refused support on the MyBB Community Forums.
                    
                     This is free software, support us and we'll support you. -->
{$lang->powered_by} <a href="http://www.mybboard.net" target="_blank">MyBB{$mybbversion}</a>, &copy; 2002-{$copy_year} <a href="http://www.mybboard.net" target="_blank">MyBB Group</a>.<br />
<br /><br />                <!-- End powered by -->
                <br />
<br class="clear" />
<!-- The following piece of code allows MyBB to run scheduled tasks. DO NOT REMOVE -->{$task_image}<!-- End task image code -->
{$auto_dst_detection}
        </div>
        </div>
I've compared another time to make sure and the files are completely same, no changes. What could be causing that?
This is really annoying. I've compared all the files menitored in the error and checked it the board on the validators - Everything clean but the goddamn error is still showing!
This is what happens when you edit a PHP file in notepad Smile Reupload fresh copies of ./inc/functions.php and ./index.php from the MyBB package without editing them in notepad. Use Notepad++, or something similar in future.
Awesome. You was right. Thank you dude!
Yeah Notepad is terrible for stuff like that; it always ends up adding weird characters- ALWAYS use something else.