PHP Sessions Not Working with IIS
Moderator: General Moderators
PHP Sessions Not Working with IIS
I have everything up and running except sessions. I have an Eclipse development environment. I have Xdebug. But sessions variables after they are set are "uninitialized" the next time the code accesses it.
I am using Windows XP and IIS 5.1.
I am using Windows XP and IIS 5.1.
Re: PHP Sessions Not Working with IIS
Do you call session_start() at the beginning of your script?
Re: PHP Sessions Not Working with IIS
And make sure the IIS user account has write permissions to the directory you've set up for session storage.
Re: PHP Sessions Not Working with IIS
This is an open source web application that I am trying to get up and running. I see that session_start() is called in about 4 different locations in the code. In fact the session variable is being read after a session_start().
I see that sessions are being written to the configured location. I just want the session variables to be read after they are written.
I see that sessions are being written to the configured location. I just want the session variables to be read after they are written.
Re: PHP Sessions Not Working with IIS
Here's some more information. I set a breakpoint where the session variable is set.
authenticatedUser is set to "Admin".
I opened some of the sessions files. Some of these files are empty and others have:
authenticatedUser|N;
Apparently the sessions are not being written out properly. Any ideas on how to fix this?
Code: Select all
session_register("authenticatedUser");
$authenticatedUser = $_POST["username"];I opened some of the sessions files. Some of these files are empty and others have:
authenticatedUser|N;
Apparently the sessions are not being written out properly. Any ideas on how to fix this?
Re: PHP Sessions Not Working with IIS
Save this as a PHP file. Browse to its address and refresh several times. Do you see incrementional numbers?
Code: Select all
<?php
session_start();
$_SESSION['i'] = isset($_SESSION['i']) ? $_SESSION['i'] + 1 : 1;
echo $_SESSION['i'];
?>There are 10 types of people in this world, those who understand binary and those who don't
Re: PHP Sessions Not Working with IIS
Yes, the numbers do increment. It appears that sessions do work in this code. My code, however, is doing a session_register in one page and an isset in another page to read the sessions and it fails.
Re: PHP Sessions Not Working with IIS
Read the Notes section in the manual:
http://bg.php.net/session_register
http://bg.php.net/session_register
There are 10 types of people in this world, those who understand binary and those who don't
Re: PHP Sessions Not Working with IIS
I use $_SESSION['authenticatedUser'] = "xxx"; instead of session_register and now everything works.