| Question : | I keep getting "headers already sent" whilst trying to use sessions
| | Answer : | > "Warning: Cannot send session cookie - headers already sent by (output
> started at d:\wwwroot\b2b\cart.php3:9) in d:\wwwroot\b2b\cart.php3 on line
> 11
>
> What is it?? I think I am missing something in the php.ini file, but I
dont
> know what.
>
> Any ideas??
>
>
I replied to Agustin as follows, hopefully it's all correct....
cheers
Peter
Hi Agustin
Check through your code prior to the session_start(); command. You will
have already output some text to the browser, and since headers (and
cookies which are contained within headers) need to be sent before any
output, this error is happening.
Look for any print, printf, or echo commands. Also look for
whitespaces, tabs etc. before the session_start();
Bear in mind your include('file') statements, they might be causing the
problem, rather than the code in the file you're working on.
HTH
Cheers
Pete
| | |