tags:

views:

283

answers:

3

I am using CakePHP 1.3 and it keeps telling me the following.

Cannot modify header information

This ONLY happens when I include the Auth component.

  var $components = array('Auth');

Am I doing something wrong, a bug, or what?

A: 

Cannot modify header information signifies that your script (in this case, the auth component) is attempting to manipulate HTTP headers after they've been sent to the client. You can counteract this behaviour by enabling output buffering with the ob_start() function.

Johannes Gorset
A: 

Headers have to be the first part of a web page that you send. Make sure that you haven't outputted any other information before you try sending any kind of header.

This may also be useful

Ben Shelock
Nevermind, I found it out. Thanks a lot.
gummybears
@gummybears: It's not dumb. The script treats a whitespace as content, just like any character. There's probably a whitespace somewhere in your code or components that's preventing you from manipulating the headers.
Johannes Gorset
A: 

It is either what FRKT mentions above, or the code is always trying to modify the headers and the included component is writing something to the output before cake has a chance to write the headers out. An example of a great cause is having extra whitespace after the %> at the end of the file. (I recommend not included the close PHP tag at the end of the files for this reason).

Jacob

TheJacobTaylor