Header Output Errors

jjpeacha

New Member
Messages
125
Reaction score
0
Points
0
Hiya,

I've setup a small forum over at animalcrossingforums.com the forums work fine so i decided I wanted a login script on my homepage, and developed it.

However I keep getting random header errors:

Warning: Cannot modify header information - headers already sent by (output started at /home/jjpeacha/public_html/animalcrossingforums.com/index.php:8) in /home/jjpeacha/public_html/animalcrossingforums.com/forums/includes/sessions.php on line 366

Warning: Cannot modify header information - headers already sent by (output started at /home/jjpeacha/public_html/animalcrossingforums.com/index.php:8) in /home/jjpeacha/public_html/animalcrossingforums.com/forums/includes/sessions.php on line 367

or sometimes these:

Warning: Cannot modify header information - headers already sent by (output started at /home/jjpeacha/public_html/animalcrossingforums.com/index.php:8) in /home/jjpeacha/public_html/animalcrossingforums.com/forums/includes/sessions.php on line 254

Warning: Cannot modify header information - headers already sent by (output started at /home/jjpeacha/public_html/animalcrossingforums.com/index.php:8) in /home/jjpeacha/public_html/animalcrossingforums.com/forums/includes/sessions.php on line 255

The forum im using is PHPBB 2.0.23 (or summit like tht). When you login the errors go, and when u logout I can't see to get the errors so I don't know whats causing it.

Thanks in advance!
 

marshian

New Member
Messages
526
Reaction score
9
Points
0
headers have to be the first thing to be send!
eg.
PHP:
<?php
echo "a";
header("Content-type: text/html");
?>
= fail

PHP:
<?php
header("Content-type: text/html");
echo "a";
?>
= good

PHP:
<?php
header("Content-type: text/html");
echo "a";
?>
= fail (there's an enter before the <?php tag, which is also output)
 

Salvatos

Member
Prime Account
Messages
562
Reaction score
1
Points
18
Your website's header may also be colliding with phpBB's one.
 

Salvatos

Member
Prime Account
Messages
562
Reaction score
1
Points
18
Well login.php (and most main phpBB pages) will call includes/page_header.php, which will in turn call for the template file overall_header.tpl (or in some cases simple_header.tpl), which will set the page header and display it. So if you work from phpBB pages and add your own stuff (headers), both may "collide" at some point. What I usually do is let phpBB output its header and then build my page below that.

I'm not an expert anyway, and I don't know exactly what you are doing, but maybe this could help you: http://www.phpbb.com/kb/article/coding-new-pages/
And more precisely this: http://www.phpbb.com/kb/article/phpbb2-sessions-integration/
 
Top