[eluser]Unknown[/eluser]
Yes, I've used the search function and read the resulting topics. Yes, I know i cannot send any output before manipulating headers. I don't. It's triple checked.
Still, can't get sessions to work.
This is the code i run:
<?php
class Ajax extends Controller
{
function index()
{
$this->load->library('session');
}
}
Nothing fancy. The closing ?> doesn't matter, it doesn't work with nor without it.
"A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\system\application\controllers\ajax.php:1)
Filename: libraries/Session.php
Line Number: 662"
Line 662 of session.php indeed modifies header information but because of some mysterious output in line 1 of my controller, cannot do that. So, what do I do?
First, i rewrote the controller in a new file, no copy-paste, to make sure the first character is a php opener. Of course, it was too simple to work and it didn't. Then, I decided to check if there are those whitespaces in line 1 that I cannot see added by a editor (I was using Notepad to make sure there aren't, but who the hell knows). I copied the entire controller code into a new file and then remove everything but the first line - I didn't want to touch it since it was the one causing the problem according to CI. Then, in line 2 i did some header manipulation:
<?php
header("Cache-Control: no-cache, must-revalidate");
Saved to new php file and run directly, outside CI.
My idea was: if there is a whitespace in line 1, it got copied so the code won't run. Well, it did. No problem at all.
But maybe the white space didn't get copied? It'd be great! No more header problems! So i changed the code (without touching the line 1) back to my controller code and run it through CI.
FAIL.
Cannot modify... line 1...
CI is out of the box, no changes made to any core files.
Changing output_buffering in php.ini doesn't help.
Please help.