ID:               11213
 Comment by:       ckathir_nkl at yahoo dot co dot in
 Reported By:      uw at netuse dot de
 Status:           Closed
 Bug Type:         *Session related
 Operating System: SunOS 5.7
 PHP Version:      4.0.5
 New Comment:

Warning: session_start(): Cannot send session cookie - headers already
sent by (output started at d:\web\shopcart_new\echopay.php:6) in
d:\web\shopcart_new\echopay.php on line 10

Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at d:\web\shopcart_new\echopay.php:6) in
d:\web\shopcart_new\echopay.php on line 10

Warning: Cannot modify header information - headers already sent by
(output started at d:\web\shopcart_new\echopay.php:6) in
d:\web\shopcart_new\echopay.php on line 17

Warning: Cannot modify header information - headers already sent by
(output started at d:\web\shopcart_new\echopay.php:6) in
d:\web\shopcart_new\echopay.php on line 18


Previous Comments:
------------------------------------------------------------------------

[2003-04-14 05:21:34] sumairi at hotmail dot com

I have the same problemwith PHP4.3.1, i don't include/require any files
before calling session_start(). I get this error even with a test PHP
file with one line having only "session_start()".

I found out that this is because the PHP file is saved with UTF-8
encoding, i tried to save it with different encodings (using Windows
Notepad). Only when I save the file with ANSI encoding it will work.

This is different than "Content-Type" header. Go to Notepad open any
txt file, and click file/save as.., see the encoding option.

------------------------------------------------------------------------

[2001-05-31 12:58:23] [EMAIL PROTECTED]

Can't reproduce with PHP 4.0.6. 

--Jani


------------------------------------------------------------------------

[2001-05-31 09:53:31] uw at netuse dot de

To debug my latest PHPLib commits I needed
some output before session_start() without sending
any headers to the browser. Well, I thought of using 
error_log() that should not output anything but write 
to my logfile. I changed my php.ini to: 

display_errors = Off    
log_errors     = On    
error_log      = [mypath]/logs/

Now I hoped that I'd be allowed to use error_log() before 
session_start(), here's a simple example:

<?php
error_log("I don't like that!");

session_start();
session_register("counter");

print ++$counter;

error_log("counter = $counter");
error_log(" ")
?>

But PHP bailed at me in the error_log:

I don't like that!
PHP Warning:  Cannot send session cookie - headers already sent in
[mypath]/bug.php3 on line 4
[mypath]/bug.php3(4) : Warning - Cannot s
end session cookie - headers already sent
PHP Warning:  Cannot send session cache limiter - headers already sent
in
[mypath]/bug.php3 on line 4
[mypath]/bug.php3(4) : Warning - Cannot s
end session cache limiter - headers already sent
counter = 1 

Hmm, did I forget a auto_prepend file, could I be doing any output
before session_start()? Let's check the results of a command line
telnet request.

HTTP/1.1 200 OK
Date: Thu, 31 May 2001 13:38:27 GMT
Server: Apache/1.3.14 (Unix) PHP/4.0.5-dev mod_ssl/2.7.1
OpenSSL/0.9.5a
X-Powered-By: PHP/4.0.5
Connection: close
Content-Type: text/html

1Connection closed by foreign host.

No, I did not output anything before session_start(). Then I
uncommented the first error_log() call and everything was just fine.
The error log showed:

counter = 1

counter = 2

... 

The problem is the same with 4.0.4pl1 (as one could expect).

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=11213&edit=1

Reply via email to