Re: $_session/$_cookie trouble
| From: | Gary | Date: | Tue, 28 Apr 2009 19:24:54 +0000 |
| Subject: | Re: $_session/$_cookie trouble | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-292101@lists.php.net to get a copy of this message | ||
Ashley
Thanks for your reply, but no, that is not it. There was no other code
prior.
Gary
"Ashley Sheridan" <ash@ashleysheridan.co.uk> wrote in message
news:1240945179.3494.61.camel@localhost.localdomain...
> On Tue, 2009-04-28 at 10:48 -0400, Gary wrote:
>> I am trying to set a cookie and a session, but seem to be running into a
>> wall.
>>
>> I have tried different variations, and keep getting the same error
>> message
>>
>> If I have this
>>
>> <?php
>>
>> session_start();
>>
>> I get this:
>> Warning: session_start() [function.session-start]: Cannot send session
>> cookie - headers already sent by (output started at
>> C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
>> C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
>>
>> Warning: session_start() [function.session-start]: Cannot send session
>> cache
>> limiter - headers already sent (output started at
>> C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
>> C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
>>
>> If I have this:
>> session_start();
>>
>> setcookie('sale_cookie','$sale_value', time()-3600);
>> setcookie('assess_cookie','$assess_value', time()-3600);
>> I get this
>>
>>
>> Warning: session_start() [function.session-start]: Cannot send session
>> cookie - headers already sent by (output started at
>> C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
>> C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
>>
>> Warning: session_start() [function.session-start]: Cannot send session
>> cache
>> limiter - headers already sent (output started at
>> C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
>> C:\xampp\htdocs\weiss\assessresult.inc.php on line 4
>>
>> Warning: Cannot modify header information - headers already sent by
>> (output
>> started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
>> C:\xampp\htdocs\weiss\assessresult.inc.php on line 6
>>
>> Warning: Cannot modify header information - headers already sent by
>> (output
>> started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in
>> C:\xampp\htdocs\weiss\assessresult.inc.php on line 7
>>
>> If I delete and start over, I stll get the "headers already sent"... I
>> have
>> tried numerous other variations, but all with the same error.
>>
>> What am I missing here?
>>
>> Thanks
>>
>> Gary
>>
>>
>>
> I would have thought it was obvious, the file assessresult.inc.php is
> being called before your session_start(). Have you put your code before
> every include?
>
>
> Ash
> www.ashleysheridan.co.uk
>