RE: [PHP] sessions trouble - SOLVED
| From: | Leston Drake | Date: | Wed, 19 Jun 2002 15:50:11 +0000 |
| Subject: | RE: [PHP] sessions trouble - SOLVED | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-102957@lists.php.net to get a copy of this message | ||
Thanks to Kirk, Rick, Jason, and other who gave me ideas about the source of the problem.
The problem went away when I upgraded my local server to PHP 4.2.1
I think the problem was
(a) 4.1.2 does not support the $_SESSION array
(b) if register_globals is Off, you have to declare global $HTTP_SESSION_VARS; to access it in the script
--Leston
I have register_globals=Off (which is what I prefer to program for). But if I change register_globals to On, and use the session_register() function, it works. With register_globals Off, using $_SESSION doesn't work. I thought that $_SESSION would work regardless of whether register_globals was On or Off. At 12:19 PM 6/18/2002, you wrote:Check the register_globals setting in php.ini. It looks likeit is "on" onthe problem server. If so, then you have two choices: 1. Turn it "off" 2. Change your code to this style: session_start(); $node = 10.2; session_register('node'); echo $node; Kirkfor my browser.-----Original Message----- From: Leston Drake [mailto:ldrake@lpsoftware.com] Sent: Tuesday, June 18, 2002 11:48 AM To: php-general@lists.php.net Subject: [PHP] sessions trouble Hello, I am unable to retrieve session variables on my local server. I'm using some code like this to test it (thanks to Ed): ------------------------------------------------------------------ session_start(); echo ":" . $_SESSION["node"] . "<br>"; $_SESSION["node"] = "10.2"; echo ":" . $_SESSION["node"] . "<br>"; ------------------------------------------------------------------ Then there is an href link to the same document, to test whether or not it can see $_SESSION["node"] the next time. It can't. The output for both requests looks like this: ------------------------------------------------------------------ Warning: Undefined index: node in c:\program files\apache group\apache\htdocs\test5.php on line 3 : :10.2 test ------------------------------------------------------------------ On another server(http://www.lpsoftware.com/phptest/test5.php) it works as expected. But I can't figure out why it doesn't work here. I'm running WinME, Apache 1.3.2, Php 4.1.2 I have cookies enabled (actually prompted so I can 'see' it)Is there some setting in php.ini that I need to change? BTW, being a php newbie I really appreciate the helpfulpeople on thislist! You're a great resource.