Cheers Chris
 
> I will try to explain using your code:
> 
> > Here's test3.cgi:
> > ======================================================
> > #! /usr/local/bin/php
> > <?php
> >     print 'Content-type: text/html' . "\n\n";
> 
> When you are running as a CGI, you can set the Content-Type header in this
> way. However, as soon as you send two sequential newlines, you are
> indicating the end of the headers and the beginning of the content.

What should be there instead of \n\n? I tried without any newlines
with the error "Cannot send session cache limiter - headers already
sent..."

One newline gives "Cannot send session cookie - headers already
sent..." and then the same error as above.

Do you know of a site where I can find "headers001" and what headers
are sent by session_start()?

Actually, my program worked just fine before my ISP upgraded to 4.3.4.


> >     session_start();
> 
> So, when you have this on the next line, PHP cannot set the Set-Cookie
> header that it is likely trying to set (in addition to whatever
> cache-related headers it may be setting, depending on your configuration).
> This is because you have already indicated the end of the headers in your
> previous line. This is the danger in writing your own headers in this way;
> you become responsible for adhering to the proper format of things.
> 
> > And test3.php:
> > ======================================================
> > <?php
> >     session_start();
> > //  print 'Content-type: text/html' . "\n\n"; // only in .cgi version!
> 
> While it's not necessary to specify Conetnt-Type here, you can do so using
> the header() function:
> 
> header('Content-Type: text/html');

Aha! That explains it a bit. Without me having to print Content-type...,
(i.e. in a .php file), sessions seem to be working just fine. 

-- 
Børge

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to