Hi,
It sounds like you are experiencing a similar problem to one I had. It seems
there are some problems with setting cookies when using IIS, and as I understand it
one of the ways that sessions work is by storing the data in a cookie on the clients
machine. On the page at www.php.net it suggests appending the session id to the url,
go here to look at that http://www.php.net/manual/en/ref.session.php,
An example of this would be;
?php
if (!session_is_registered('count')) {
session_register('count');
$count = 1;
}
else {
$count++;
}
?
Hello visitor, you have seen this page ?php echo $count; ? times.p;
?php
# the ?php echo SID? (?=SID? can be used if short tag is enabled)
# is necessary to preserve the session id
# in the case that the user has disabled cookies
?
To continue, A HREF=nextpage.php??php echo SID?click here/A
on the notes at the bottom someone said this, sounds like a similar problem,
[EMAIL PROTECTED]
01-Apr-2002 04:30
Using PHP 4.1.2 on IIS 5.0, Win2k, haven't migrated app yet to Linux
(later!)
Managed to eventually get the sessions to work as follows.
In the php.ini, session.auto_start = 1
Then without a session_start();
$xvar = something ;
Use
session_register(xvar);
then u CAN retrieve from a later page using the new way:
$var = $_SESSION[xvar] ;
also without session_start();
even doing a var_dump($_SESSION); seems to work at least some of the time!
The odd thing is that storing vars using the new way:
$_SESSION[xvar] = something;
will save only for the CURRENT page, this gets lost when moving on to the
next page!
best regards
Mike
Hope this helps with your problem,
Steve.
- Original Message -
From: Wolfram Kriesing [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, April 02, 2002 10:44 AM
Subject: [PHP] help please - strange session behaviour on IIS with php4.1.2
i've written a simple script, which tests the session behaviour on the IIS,
since it didnt seem to work
the following script should increase the session-var $testVar and display it
but it always stays at the same value
can someone explain that? is that a bug?
also if i would increase $_SESSION['testVar'] it doesnt work.
i have been looking at the server and the session-file is also updated, but
not with the new values, only the timestamp is updated, it seems
session_start();
// make the session variable globally available
// we have register_globals = Off
$testVar = $_SESSION['testVar'];
// init testVar to 1 or increase it
if( !isset($testVar) )
{
print 'set testVar to 1br';
$testVar = 1;
}
else
{
print 'increasebr';
$testVar++;
}
// i can put session_register before
// or after the 'if' it always happens the same
session_register('testVar');
print $testVar;
the environment:
- IIS-Server5.0, WIN2k
- PHP4.1.2
- session.auto_start = 0
- register_globals = Off
i am using the recommended-php.ini, that's why register_globals is off
thanks for help
--
Wolfram
... translating template engine
http://sf.net/projects/simpletpl
... authentication system
http://sf.net/projects/auth
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php