This is a roll call to get some feedback on an issue which has been dogging me for some time now.
In a nutshell, I would like to know anyone and everyone who currently believes they are successfully using PHP4's session variables features (NOT PHPLI😎 running Windows NT/2000 using IIS as the webserver, and using PHP 4.0.4 or newer. I need your help.
Though I doubt anyone recognizes me, I have posted various replies on PHPBuilder whenever I thought I could be of some help, and with regard to PHP4 session variable questions, I have directed anyone who would listen over to the PHP BUG database to read the postings I placed there (bug #5493 & #8989), located at
http://www.php.net/bugs.php?id=5493
http://www.php.net/bugs.php?id=8989
respectively. The short version is, prior to PHP 4.0.2, there was an issue where session variables did not maintain their values, basically because new session IDs (and therefore, new session files) kept being generated for the same session. Result: when the 2nd session file was generated, it contained no data for the current session, so variables were in essence cleared. This issue was resolved in the PHP 4.0.2 CGI module, but not the ISAPI module. However, with the release of PHP 4.0.4, the problem resurfaced. The last known (to me anyway) working version of PHP which did session variables properly running in a Windows/IIS environment was 4.0.3pl1, which I use to this day.
I have posted as much information on PHP's bug site as possible regarding this issue, including the sample scripts below, so they could duplicate the errors I was seeing. However, the issue remains to this day in PHP 4.0.6. I have duplicated this issue on Windows NT4 SP5 running IIS4, then on Windows 2000 SP1/SP2 running IIS5, and the problem is always there. I do not believe this error to be an isolated case, as I have duplicated it on about 1/2 dozen systems. However, no one else has posted support to the bug database indicating they are experiencing the same.
So now I am asking the PHP community directly. Is anyone out there able to make PHP4 sessions work for them, where the system you are using is a Microsoft Windows NT/2000 environment running IIS4/5 and using PHP 4.0.4 or newer? If so, are you only using sessions within a single file, or do you maintain state across various pages?
Ideally, if any of you who DO believe you meet the criteria above could do me a HUGE favor, please follow the steps below and tell me whether this works for you. Whether these steps result in the proper result or not, please post here, so we can build a history that we might present to the PHP development team. Thank you in advance for your time and help.
- Create the file 'page1.php' as follows (copy/paste if you can to save time):
__________________________________________________
<?
session_start();
if (!$PHPSESSID) {
$userid=100;
$firstaccess=time();
$lastaccess=time();
session_register("userid");
session_register("firstaccess");
session_register("lastaccess");
}
$lastaccess = time();
?>
<HEAD>
<TITLE>Page 1</TITLE>
</HEAD>
<BODY>
This is page 1.<br>
<?
echo "\$PHPSESSID = '$PHPSESSID'<br>";
echo "\$userid = '$userid'<br>";
echo "\$firstaccess = '$firstaccess'<br>";
echo "\$lastaccess = '$lastaccess'<p>";
?>
<A HREF="page2.php">Page 2</A>.<p>
</BODY>
- Create files page2.php, page3.php, & page4.php, copying the code above.
The only changes that needs to be made are to change the <TITLE> for
each file as appropriate, the one line (though this was superflous), and the
<A HREF> tag so that essentially
PAGE1.PHP -> PAGE2.PHP -> PAGE3.PHP -> PAGE4.PHP -> PAGE1.PHP
thus creating a loop that cycles around the 4 pages.
Make sure the PHP.INI file is properly configured to store session files (for
this example, I'm assuming PHP.INI is configured to store the session
files in \InetPub\sessions). Then either open a Command Prompt to this
directory or use Explorer (whatever suits you).
Serving these files from IIS (say \InetPub\wwwroot), load page1.php.
Look in the session directory. You should see a session file created. Note
its size (60 bytes in this case).
Now start clicking on the link on page1.php. This will load page2.php, which
shows the current value of the session ID. Keep clicking on the links and
keep watching the session directory.
What you should find is that new session files are being created, session files that are 0 bytes and contain NOTHING. This is a serious problem. It's makes session management useless in PHP under Windows.
If you experience different results, please let me know how your system is configured. Currently, the only way I can work with PHP sessions is to run PHP 4.0.3pl1 (CGI module only). As such, I'm missing out on all the changes that have been occurring in other areas with PHP, and I'd like very much to be able to run PHP 4.0.6 if possible.
Again, thanks in advance to anyone and everyone who posts here. I really appreciate your help in this regard, no matter whether it points out that my situation is unique to me, or whether it is, as I fear, occurring for everyone who attempts to use sessions in MS Windows.