Page 1 of 1

Help me please with session

Posted: Mon Apr 16, 2007 5:43 am
by Lex82
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


My script is beginning from:

Code: Select all

<?php
  error_reporting( E_ALL & ~E_NOTICE );
  session_start(); ...
When I am using an interpreter I get messages:

Warning: session_start(): Cannot send session cookie – headers already sent in D:\dane\worck space\mgmt_main_Temp.phtml on line 3

Warning: session_start(): Cannot send session cache limiter – headers already sent (output started at D:\dane\worck space\mgmt_main_Temp.phtml:3) in D:\dane\worck space\mgmt_main_Temp.phtml on line 3

What is this kind of problem and how to resolve it
:?:


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

[quote="[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1"][b]11.[/b] Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.

Some examples of what not to do are ne1, any1 (anyone); u (you); ur (your or you're); 2 (to too); prolly (probably); afaik (as far as I know); etc.[/quote]

Posted: Mon Apr 16, 2007 6:59 am
by mentor
There is some sort of output on line in 3 mgmt_main_Temp.phtml. This can be some whitespace, empty string etc.

Posted: Tue Apr 17, 2007 8:29 am
by Lex82
I'm realy beginer of PHP :roll: May be some one know some web sites when I can read about solutions of this problem.

hi

Posted: Tue Apr 17, 2007 10:22 am
by sarbas
hi Lex82,

You should start the session at the beginning line.
for Example

Code: Select all

<?php
  session_start(); 
  error_reporting( E_ALL & ~E_NOTICE );
?>
try this one.

Thanks with Regards
Sarbas

Posted: Tue Apr 17, 2007 10:58 am
by RobertGonzalez
error_reporting does not output anything. headers sent means that you are trying to send response headers after already outputting something to the browser. The most typical reason behind this is outputting HTML before the call to session_start(), setcookie() and header(). Those functions, because of what they do, need to be called before any output is sent to the browser.

As has been mentioned earlier, check the file that is referencing in the warning. At line 3 something is being output. It is not a problem, just a code flow issue.