Re: Session not working
| From: | Rob Adams | Date: | Wed, 30 Jul 2003 21:03:49 +0000 |
| Subject: | Re: Session not working | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-20938@lists.php.net to get a copy of this message | ||
"Voodoo" <voodoo36@terra.com.br> wrote in message
news:20030730031137.84128.qmail@pb1.pair.com...
> I'm using a local Apache 1.3 server on WinXP, and I've gotta test some php
> scripts at home, can't publish them. I'm trying to set some session vars,
> but the variables simply disappear when I try to use them again. Made the
> following code to test it, but when I click on 'increment' the 'numb' var
is
> set to 0 again.
>
>
> //code on test.php:
> <?php
> session_start();
> if (isset($_SESSION['numb'])) {
> $_SESSION['numb']++;
> } else {
> $_SESSION['numb'] = 0;
> }
> echo $_SESSION['numb']."<br>";
> ?>
> <a href="test.php">Increment</a>
I copied and pasted the above code and it worked perfectly. You may need to
check some following settings in your php.ini
session.use_cookies
session.use_trans_sid
session.cookie_path
session.save_path.
These are some I can think of right off that might be causing problems.
You're probably using cookies, and I'd bet the save_path needs setting, as
it probably wouldn't default to something valid.
-- Rob
>
> The strange thing is that when I publish this 'test.php' file on a web
> server it works just fine. I think there's something wrong with my local
> server configuration or at the php.ini file, but I can't figure out what
is
> it.
>
> Can somebody help me?
>
> Thanks,
>
> Voodoo
>
>