Mimi wrote:
[color=blue]
> Hello,
>
> I am having trouble using the session vars in
> PHP 4.3.9
> OS: Win XP Prof
> Web Server IIS (is local and there are no links to other servers from
> the web pages I work on)
> Browser: IE 6.0
>
> The problem I am having is that each time I reload the same PHP page, I
> get a different
> Session ID (and thus all session vars are lost from one page to another).
>
> let's say in firstpage.php I set
> $_SESSION["firstvar"] = "someval";
> $_SESSION["secvar"] = "otherval";
>
> and in secpage.php I try to retrieve $_SESSION["firstvar"] , it gives me
> "Undefined Index error"
> I did not know what is happening and when printing out the session id
> (echo SID;) I found out
> that the ID is changing every time page is reloaded or when moving to
> another page.
>
> The problem is that I don't know what might reset the session since I use
> "session_auto_start"
> and have not played with session_start, session_destroy or anything else.
>
> Can someone give me a hint on what might cause this ?
>
> Thanks
>
>
>
> Settings taken from PHP_INFO:
> ================================================== ========
> Session Support enabled
> Registered save handlers files user
>
> Directive Local Value Master Value
> session.auto_start On On
> session.bug_compat_42 On On
> session.bug_compat_warn On On
> session.cache_expire 180 180
> session.cache_limiter nocache nocache
> session.cookie_domain no value no value
> session.cookie_lifetime 0 0
> session.cookie_path / /
> session.cookie_secure Off Off
> session.entropy_file no value no value
> session.entropy_length 0 0
> session.gc_divisor 100 100
> session.gc_maxlifetime 1440 1440
> session.gc_probability 1 1
> session.name PHPSESSID PHPSESSID
> session.referer_check no value no value
> session.save_handler files files
> session.save_path D:\PHP\SessionData D:\PHP\SessionData
> session.serialize_handler php php
> session.use_cookies On On
> session.use_only_cookies Off Off
> session.use_trans_sid Off Off[/color]
Looks good to me.
Are you maybe jumping to another domain too when you say you jump to another
page?
Cookies are invisible when the domain changes (or even path in the same
domain in some cases)
http://www.domain1.com/somephp.php <- sets cookie with PHPSESSIONID
http://www.domain2.com/somephp.php <- invisible here
I am unsure if that is the case of course.
A great way to debug theese kind of problems is by simply investigating the
cookies set on your browser.
(Use Firefox or Mozilla for a userfriendly cookieviewer under tools)
Regards,
Erwin Moller