Avinash Korwarkar wrote:
Hi Guys,
I am using sessions to store the login name and then retrieve it on
every page. Here are the details of the php settings.
1) I have PHP 4.2.2 installed on a Apache 1.3.27 server.
2) I have register_globals off.
3) I use $_session['loginname']= $loginname to store the loginname
into the session and then retrieve it on other pages using a
$HTTP_SESSION_VARS['loginname'].
My problem is that sometimes, I am able to retrieve the loginname from
the session and sometimes I am not. When I am not able to get the
loginname, I refresh the page 3-4 times and the loginname shows up.
This happens on every page. Am I screwing up somewhere? Does this
depened on the speed of the server?
Hi Avinash,
No, not the speed of the server.
Check the following:
1) Do you ALWAYS start your php-scripts with session_start() ??
Or
Alternatively: did you put session.auto_start = 1 in your php.ini file?\
2) Be sure you did not produce any output before the first session-calls.
3) To debug, check the coockies in your webbrowser. Delete them, log in
again, check what is set, etc.etc. You can also check the real content of a
session by finding the right one in the temp-directory as set in php.ini
(On my system: session.save_path = /tmp)
4) Last but not least: I had trouble with PHP-sessions too under 4.2 that
was soo darn vague and difficult to replicate, I got a real headage of it.
I upgraded to php4.3, problems gone....
(I could only find some scattered remarks on this, not a lot.)
Good luck,
Regrads,
Erwin Moller