[ciapug] What does it mean?

Jane Swanson ciapug@cialug.org
Fri, 20 Jun 2003 16:32:26 -0500


My code starts:

#!/usr/local/bin/php
<?php
 session_start();
 $_SESSION['sessID'] = 'test';
 $_SESSION['searchID'] = 2;
// ?>
// <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
//<html>
//<head>

Both warning messages show.  Then, on the next program

#!/usr/local/bin/php
<?php
 session_start();
 echo 'The content of $_SESSION[\'searchID\'] is '
   .$_SESSION['searchID'].'<br />';
 echo 'The content of $_SESSION[\'sessID\'] is '
   .$_SESSION['sessID'].'<br />';
?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>

This does print the values, but the second warning shows.

My host requires "#!/usr/local/bin/php" to identify the location of PHP.
Am I doing that wrong?  Is that statement why I'm getting the warnings?

JBS
----- Original Message ----- 
From: <vanish@dreamscapevisionery.com>
To: <ciapug@cialug.org>
Sent: Friday, June 20, 2003 12:38 PM
Subject: Re: [ciapug] What does it mean?


> That means you're sending session_start() after you've sent HTML. YOu need
to
> place session_start() above any HTML sent by the page. Once you send any
> information to the browser, you can't request a session or Location
change,
> among others.
>
> Quoting Jane Swanson <jswanson@website-center.com>:
>
> > First [of many]:  I get the following warning message at the first page
of my
> > session:
> >       Warning</b>:  Cannot send session cookie - headers already sent by
> > (output started at /home/...cgi-bin/select.php:2) in
> > <b>/home/...cgi-bin/select.php</b> on line <b>3</b><br>
> >
> >       ANd on all pages:
> >             <b>Warning</b>:  Cannot send session cache limiter - headers
> > already sent (output started at /home/....cgi-bin/select.php:2) in
> > <b>/home/....cgi-bin/select.php</b> on line <b>3</b><br>
> >
> >       I can suppress the messages if I use @ with my  session_start().
What
> > do they mean?  My session variables pass as:
> >
> >        $_SESSION['sessID'] = 'test';
> >        $_SESSION['searchID'] = 2;
> >
> >       Enough for the first Q.  Is this telling me something I should
know?
> >
> >       JBS
> >
>
>
>
> _______________________________________________
> ciapug mailing list
> ciapug@cialug.org
> http://cialug.org/mailman/listinfo/ciapug
>