Welcome Guest, Not a member yet? Register   Sign In
"Cannot modify headers" error
#1

[eluser]Unknown[/eluser]
Yes I've seen this error reported a lot, and people most often say that its a blank space/line somewhere... But it doesnt seem to be the case with me.
This error has been haunting me for months, but by playing around a bit... I found out that maybe, the cul print is the 'base_ur()' method.
I was experimenting with something in a view, but found out that when calling base-url(), it gives me this error. However, the weird thing it doesnt always do it. If I use it fewer times, then the page loads normally. But then if I use it a lot of times, it gives me that error.

Maybe I'm completely wrong, but in the view, there really isnt any other PHP than base_url. Can anyone help?

here's the error in question for reference(hid part of the path):
Quote:A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at \system\core\Output.php:445)

Filename: libraries/Session.php

Line Number: 675
#2

[eluser]CroNiX[/eluser]
Are you echoing anything directly from the controller anywhere? Perhaps just echoing a var out for troubleshooting? You should post the controller as well as the view to troubleshoot this.

It can also happen if you are displaying php errors which is often the case in development, and one of your methods causes a php error/warning/notice/etc. PHP will print it out to the screen (if enabled), which also can cause this error since that output will go out before the headers do.

All of CI's output (using views, or the output class directly) uses output buffering. If something gets sent to the browser before CI sends it's buffer, whether it's an echo from a controller or an error getting printed out, it will error out.





Theme © iAndrew 2016 - Forum software by © MyBB