Re: [PHP4BETA] session question...
| From: | David Sheckler | Date: | Wed, 24 Nov 1999 00:06:00 +0000 |
| Subject: | Re: [PHP4BETA] session question... | ||
| References: | 1 2 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-6791@lists.php.net to get a copy of this message | ||
I got rid of the printf statements and tried something more basic but
still got the same error. The following script calls itself:
________________________________________
<html>
<body>
<?php
session_register("count"); //line 7
$count++;
?>
Hello visitor, you have seen this page <? echo $count; ?> times.<p>
To continue, <A HREF="session.php4?<?=SID?>">click here</A>
</html>
</body>
________________________________________
The output:
________________________________________
Warning: Cannot add header information - headers already sent in
/usr/local/apache/clm2/session.php4 on line 7
Hello visitor, you have seen this page 1 times.
To continue, click here
There are no echo or printf statements to mess up the client. The first
thing I do is session_register. I copied this out of the description of
session_register in the docs. It almost seems if as if apache is
generating the header for me.
Thanks!
Dave Sheckler.
Sascha Schumann wrote:
>
> On Tue, Nov 23, 1999 at 03:02:48PM -0800, David Sheckler wrote:
> > I've read the docs, but session variables have presented quite the trial
> > for me.
>
> The docs need some major improvements; I know that, but I
> don't have the time to do it currently.
>
> > My first question is, does apache or php4 require certain modules
> > compiled with it so php4/apache can use session variables? My first
> > assumption (after checking my syntax) was that I had missed some compile
> > options or modules.
>
> It's compiled in by default.
>
> > I've compiled php4b3 with --enable-trans-sid, --enable-track-vars,
> > --with-mysql, --with-apache=/opt/apache_1.3.9. I read a couple of posts
> > that said you had to have trans-sid and track-vars.
>
> Both are optional; track-vars is required to make the cookie
> vs. URL-propagation test work (otherwise SID will always be
> defined).
>
> > Apache was compiled with php4 and mod_rewrite.
> >
> > I'm attempting do a '<META http-equiv="refresh" content="15;
> > URL=http://198.145.105.139/clm2/clm2.php4">'
> > of a web page, every 15
> > seconds or so, when I refresh I want to maintain the state of my count
> > so when I do, I can output the next 30 lines out to a fresh page.
>
> URL=http://...?<?=SID?>
>
> > __________________________
> > count not registered
> > Warning: Cannot add header information - headers already sent in
> > /usr/local/apache/clm2/clm2.php4 on line 56
> > ___________________________
>
> You print out some text before the session is started (which
> causes the cookie to be sent). Any kind of data sent to the
> client before session_start/session_register is called will
> cause the above message.
>
> As a workaround, you might want to enable output_buffering in
> the configuration.
>
> --
>
> Regards,
>
> Sascha Schumann
> Consultant
>