Re: [PHP4BETA] generating new session-id on every page
| From: | Chris King | Date: | Mon, 06 Mar 2000 15:41:29 +0000 |
| Subject: | Re: [PHP4BETA] generating new session-id on every page | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-11587@lists.php.net to get a copy of this message | ||
You need a session_start() at the beginning of any page you use sessions
on. That function will create/read the cookie in the browser to correctly
pass the variables among pages.
Regards,
Chris
Terje With Lunndal wrote:
> i fear that i have misunderstood something basic, but due to the
> limitations in the docs for sessions in php4, i'll plead ignorgance and
> post my problem :)
>
> i have lots of problems with getting php4 to handle sessions correctly.
> it seems that it generates a new SID every time.
>
> my testpage is count.php and looks like this:
>
> <?php
> session_register("count");
> $count++;
> print '<html>';
> print '<p>the counter is: '.$count.'</p>';
> print '<p><a href="count.php">increment</a></p>';
> print '</html>';
> ?>
>
> now if i reload the page with the reload-button in Netscape, it acts
> like i want it to, incrementing the counter. but if i press the link and
> thus loads the document as a new one, it sets a new session cookie.
>
> is there something i am missing out on here?
>
> i am running FreeBSD 3.4-STABLE with Apache and php4b4pl1.
> i compiled Apache as the "quick install" directions in the php4
> INSTALL-file suggested. - no fancy stuff in the configure. only
> --with-mysql and --enable-track-vars.
>
> the session section of my php.ini looks like this:
>
> [Session]
> session.save_handler = files ; handler used to store/retrieve
> data
> session.save_path = /tmp ; argument passed to save_handler
> ; in the case of files, this is the
> ; path where data files are stored
> session.use_cookies = 1 ; whether to use cookies
> session.name = PHPSESSID
> ; name of the session
> ; is used as cookie name
> session.auto_start = 0 ; initialize session on request
> startup
> session.cookie_lifetime = 0 ; lifetime in seconds of cookie
> ; or if 0, until browser is
> restarted
> session.cookie_path = / ; the path the cookie is valid for
> session.cookie_domain = ; the domain the cookie is valid for
> session.serialize_handler = php ; handler used to serialize data
> ; php is the standard serializer of
> PHP
> session.gc_probability = 1 ; procentual probability that the
> ; 'garbage collection' process is
> started
> ; on every session initialization
> session.gc_maxlifetime = 1440 ; after this number of seconds,
> stored
> ; data will be seen as 'garbage' and
> ; cleaned up by the gc process
> session.referer_check = 1 ; check HTTP Referer to invalidate
> ; externally stored URLs containing
> ids
> session.entropy_length = 0 ; how many bytes to read from the
> file
> session.entropy_file = ; specified here to create the
> session id
> ; session.entropy_length = 16
> ; session.entropy_file = /dev/urandom
> session.cache_limiter = nocache ; set to {nocache,private,public} to
> ; determine HTTP caching aspects
> session.cache_expire = 180 ; document expires after n minutes
>
> hope someone can enlighten me.
>
> Terje
> --
> Terje With Lunndal
> KPNQwest Norway
>
> --
> PHP 4.0 Beta Mailing List <http://www.php.net/version4/>
> To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net
> For additional commands, e-mail: php4beta-help@lists.php.net
> To contact the list administrators, e-mail: php4beta-admin@lists.php.net