View Full Version : Headers Output

08-10-2007, 04:58 PM
<b>Warning</b>: Cannot modify header information - headers already sent by (output started at /home/fantasy3/public_html/rose/theproject/config.php:19) in <b>/home/fantasy3/public_html/rose/theproject/secure.php</b> on line <b>9</b><br />

header('Location: login.php'); is line 9. It won't let me use the header function.

line 19 of config is just the end of the file. Any help?

08-10-2007, 05:13 PM
Does your config.php have this at the beginning and end?



08-10-2007, 05:19 PM
yea it does...shoudln't it?

08-10-2007, 06:12 PM
Yes it should. Is there anything after the ?>, including blank lines, spaces, etc?

08-10-2007, 07:04 PM
darn ... I thought that would be it.

How is config.php called?

Is there something in another script that has "require" or "require-once"
to include that script? I'm trying to imagine why it thinks there are
duplicate headers.

08-10-2007, 11:42 PM
You're outputting something around line 19 in the config.php file.

08-11-2007, 01:39 AM
They were blank spaces. I call like 3 files, one is the HTML headers like meta codes and stuff. Should headers be before that?

08-11-2007, 01:43 AM
You cannot have ANY form of output before a header() call. Not a space, not an echo, not a cookie, not a session.

08-11-2007, 01:50 AM
Actually, a cookie and a session use headers, so they can be used.

08-11-2007, 01:50 AM
So you could session_start() and then use a header() call under that?

08-11-2007, 01:59 AM
Yes, give it a try.

08-11-2007, 02:00 AM
yes you can, how else would you be able to log someone on with out starting a session?

but yes ole90 it sounds like you have added another header()
just try and comment out anything that isn't to vital and see the results.

08-11-2007, 02:02 AM
CFMaBiSmAd - I didn't know that, I had some code I put together not too long ago, which handled sessions, but then lower in my code I was doing some image conversion using GD, which required a header() call, and it kept bombing, strange.