[eluser]cobolCowboy[/eluser]
Hello,
Thanks to this framework I've been able to learn some PHP and OOP after three decades of linear COBOL programming. Thanks for that.
I looked for an answer to this but to no avail.
I'm running a WAMP server, using PHP 5.3.10 and CI 2.1.3
MY_Controller, in the error text, which lives in app\core\MY_Controller.php looks like this...
Code:
<?php
class MY_Controller extends CI_Controller
{
function __construct()
{
parent::__construct();
if (!$this->session->userdata('loggedin'))
{
redirect('login');
}
}
}
I did this so that any page that requires being logged in will extend this controller instead of CI_Controller,
but the weirdest part is that I have not yet extended this controller anywhere ?!
The full text of the error is this...
Quote:A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at C:\wamp\www\app\core\MY_Controller.php:1)
Filename: libraries/Session.php
Line Number: 676
Considering that I have not overridden the session library, then I'm lead to believe that this must be pointing to sys\libraries\session.php.
Line 676 points directly to the setcookie statement...
Code:
setcookie(
$this->sess_cookie_name,
$cookie_data,
$expire,
$this->cookie_path,
$this->cookie_domain,
$this->cookie_secure
);
Doesn't setting the cookie constitute output to the browser?
And once you do that, you can't then later send out browser content without getting this "severe" type error.
I commented this statement and the error went away. But then a cookie doesn't get set.
What's the ramifications of that? How do we solve this problem?