Welcome Guest, Not a member yet? Register   Sign In
Unload the session library
#1

[eluser]aroman[/eluser]
Hi good morning guys,
this is the error ive encountered that made me a headache..
Code:
<p>Severity: Warning</p>
<p>Message:  Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\auction_dev_beta1\system\application\controllers\feed.php:1)</p>
<p>Filename: libraries/Session.php</p>
<p>Line Number: 315</p>
i got this error above when i autoload the session lib inside autoload.php..
but when i don't autoload the session lib but manually load for each controllers(i have 10 controllers), it works fine.

My question is, is it possible to unload the session lib for that particular controller like contact_us controller ?

Any ideas ?
Thanks and have a nice day..
-aroman
#2

[eluser]tomcode[/eluser]
Hi aroman,

Quote:C:\xampp\htdocs\auction_dev_beta1\system\application\controllers\feed.php:1

Have a look at Your feed controller on line 1.

Your're probably sending a whitespace to the browser.
#3

[eluser]aroman[/eluser]
hi tomcode,

ive check my feed controller and some of my controllers, i didnot find any whitespace or single characters.
hmm, i have something to show you some javascripts:
Code:
&lt;!-------------- START SCRIPT ADS ---------------&gt;
<scr1pt type="text/javascript" src="http://localhost/auction_dev_beta1/js/jsr_class.js" ></scr1pt>
<scr1pt type="text/javascr1pt" >
function addScript( )
{
    var obj = new JSONscriptRequest( "http://localhost/auction_dev_beta1/feed/get/92" ) ;
    obj.buildScriptTag() ;
    obj.addScriptTag() ;
}
and so on . . .
as you can see the JSONscriptRequest function is calling my feed controller by url,
is the session lib will just neglect the javascript lines above ?

thanks
-aroman
#4

[eluser]tomcode[/eluser]
I don't see what the Javascript has to do with the problem. ( why do You use scr1pt )

When auto loading You're sending the headers before entering the controller. So have a look what You're loading inbetween (turn logging on and inspect the log file).

Did You check for chars outside the closing PHP tags ? - You can eliminate them all, one thing less to worry about.
#5

[eluser]Mirage[/eluser]
aroman -

Let's see your autoload config. There's a sequence in which items are autoloaded. Anything that you autoload before session that might output something will cause the problem.


Cheers,
-m
#6

[eluser]tomcode[/eluser]
Mirage is right and I am wrong. Thanks Mirage.
#7

[eluser]aroman[/eluser]
hi mirage good morning..
below is the sequenced of the libraries inside my autoload.php
Code:
$autoload['libraries'] = array( 'database', 'session', 'simple_auth', 'themes', 'auction', 'site_settings' );

ive checked the database lib and i didnot find any whitespace characters..


@tomcode
Hi tom, i use scr1pt bec. this forum didnot allow to put a script tags inside the message, so i jst rename it.

I'll try to check this thing where the header information was started.
Thanks guys,
-aroman
#8

[eluser]Mirage[/eluser]
Hi -

I might not only be white spaces. In fact the core libraries are unlikely the source of the problem unless you touched them.

Curious - Why are you autoloading the database library? Can you try loading after the session?

Cheers
-m
#9

[eluser]tomcode[/eluser]
@aroman,

Didn't know that with filter for uploading.

For tracing Your error :

Turn logging on* and then You can see in the log file which files are loaded and when.

Me, too, I don't think that's one of the core files which causes problems.

*:
In the confg file system/application/config/config.php set :

Code:
$config['log_threshold'] = 4;
#10

[eluser]aroman[/eluser]
Hi guys,
ive fixed the problem regarding this error message "Cannot modify header information - headers already sent by ..."
I try to set $config['log_threshold'] = 4, run the page and checkd the log files,
this is what i got:
Code:
. . .
10 DEBUG - 2008-09-15 18:01:22 --&gt; Database Driver Class Initialized
11 DEBUG - 2008-09-15 18:01:22 --&gt; Session Class Initialized
12 DEBUG - 2008-09-15 18:01:22 --&gt; A session cookie was not found.
13 ERROR - 2008-09-15 18:01:22 --&gt; Severity: Warning  --&gt; Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\auction_dev_beta1\system\application\controllers\feed.php:1) C:\xampp\htdocs\auction_dev_beta1\system\libraries\Session.php 315
14 DEBUG - 2008-09-15 18:01:22 --&gt; Model Class Initialized
and so on . . .

as we can see, the severity warning starts at LINE 13 but on LINE 12, a session cookie was not found..
so what i did, i create a file MY_Session.php and put @ symbol (@ used to suppress the error of the function)
Code:
@setcookie(
$this->sess_cookie,
$cookie_data,
$this->sess_length + time(),
$this->CI->config->item('cookie_path'),
$this->CI->config->item('cookie_domain'),
0 );
now, my feed controller works in IE..
in Firefox it runs smoothly even if i didnt put @ symbol in setcookie().

I think browser IE handles differently when executing the setcookie() function, im not so sure about this.

To Mirage and Tomcode,, thank you so much guys! Smile
-aroman




Theme © iAndrew 2016 - Forum software by © MyBB