You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by michele digioia <mi...@tiscali.it> on 2004/02/12 09:58:39 UTC

[users@httpd] Cannot send session cookie

Hi, I'm a new user. I have this problem: when a session_start() php request is sended to the apache server that I admin (by few days), it responses with following messages:

Warning: Cannot send session cookie - headers already sent by (output started at .../Admin/Dbconnector.inc:120) in .../Admin/login.php on line 4

Warning: Cannot send session cache limiter - headers already sent (output started at .../Admin/Dbconnector.inc:120) in .../Admin/login.php on line 4

Is this a problem of php or apache? And how can I solve it? Thanks.
Michele

Re: [users@httpd] Cannot send session cookie

Posted by Adam Goldstein <wh...@whitewlf.net>.
Even oddball characters like linefeeds and such sent before the </head> 
tag will cause this.  Some WYSIWYG tools drop erroneous stuff up there 
by accident. It makes the server think it is html.  Also, you can get 
around this, if necessary, by changing the directives in the php.ini 
file to buffer/parse the page in full before sending... though, that is 
really a kludge.

-- 
Adam Goldstein
White Wolf Networks
http://whitewlf.net


On Feb 12, 2004, at 4:40 AM, Jez Hancock wrote:

> On Thu, Feb 12, 2004 at 09:58:39AM +0100, michele digioia wrote:
>> Hi, I'm a new user. I have this problem: when a session_start() php
>> request is sended to the apache server that I admin (by few days), it
>> responses with following messages:
>>
>> Warning: Cannot send session cookie - headers already sent by (output
>> started at .../Admin/Dbconnector.inc:120) in .../Admin/login.php on
>> line 4
>>
>> Warning: Cannot send session cache limiter - headers already sent
>> (output started at .../Admin/Dbconnector.inc:120) in
>> .../Admin/login.php on line 4
>>
>> Is this a problem of php or apache? And how can I solve it? Thanks.
>
> This is a PHP problem and so OT here.
>
> As a hint - make sure your script hasn't already sent out any HTML to
> the browser before it's trying to set a session variable.
>
> The error occurs because PHP can only send session data in the HTTP
> headers sent out from the web server - if you've already sent out some
> HTML / output to the browser this means the HTTP headers have already
> been sent and so if you try sending session data at that point the 
> error
> you get occurs.
>
> -- 
> Jez Hancock
>  - System Administrator / PHP Developer
>
> http://munk.nu/
> http://jez.hancock-family.com/  - Another FreeBSD Diary
> http://ipfwstats.sf.net/        - ipfw peruser traffic logging
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server 
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Cannot send session cookie

Posted by michele digioia <mi...@tiscali.it>.
I'm sorry for OT.
Thanks for your help.
Mic

----- Original Message -----
From: "Jez Hancock" <je...@munk.nu>
To: "michele digioia" <mi...@tiscali.it>

> This is a PHP problem and so OT here.
>
> As a hint - make sure your script hasn't already sent out any HTML to
> the browser before it's trying to set a session variable.
>
> The error occurs because PHP can only send session data in the HTTP
> headers sent out from the web server - if you've already sent out some
> HTML / output to the browser this means the HTTP headers have already
> been sent and so if you try sending session data at that point the error
> you get occurs.
>
> --
> Jez Hancock
>  - System Administrator / PHP Developer
>
> http://munk.nu/
> http://jez.hancock-family.com/  - Another FreeBSD Diary
> http://ipfwstats.sf.net/        - ipfw peruser traffic logging
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Cannot send session cookie

Posted by Jez Hancock <je...@munk.nu>.
On Thu, Feb 12, 2004 at 09:58:39AM +0100, michele digioia wrote:
> Hi, I'm a new user. I have this problem: when a session_start() php
> request is sended to the apache server that I admin (by few days), it
> responses with following messages:
> 
> Warning: Cannot send session cookie - headers already sent by (output
> started at .../Admin/Dbconnector.inc:120) in .../Admin/login.php on
> line 4
> 
> Warning: Cannot send session cache limiter - headers already sent
> (output started at .../Admin/Dbconnector.inc:120) in
> .../Admin/login.php on line 4
> 
> Is this a problem of php or apache? And how can I solve it? Thanks.

This is a PHP problem and so OT here.

As a hint - make sure your script hasn't already sent out any HTML to
the browser before it's trying to set a session variable.  

The error occurs because PHP can only send session data in the HTTP
headers sent out from the web server - if you've already sent out some
HTML / output to the browser this means the HTTP headers have already
been sent and so if you try sending session data at that point the error
you get occurs.

-- 
Jez Hancock
 - System Administrator / PHP Developer

http://munk.nu/
http://jez.hancock-family.com/  - Another FreeBSD Diary
http://ipfwstats.sf.net/        - ipfw peruser traffic logging

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org