NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP Sessions on windows

Tom tom at supertom.com
Sun Jul 31 16:04:25 EDT 2005


Hey folks,
 
I really must be missing something, and I just can't figure it out.  I can't
seem to get sessions working on windows.  I'm using PHP5.1 beta 3 (I just
upgraded to this, I was using 5.0.4, sessions didn't work there, either),
Apache 2.0.53 on Windows 2000 Professional (workstation, not server).
 
The problem appears to be that the session file is created (and it has data
in it), but not "re-read", meaning that a new session is ALWAYS created.
 
Apache was originally running as the "LocalSystem" user, I changed it to
Administrator, with no change.
 
Here are the PHP session settings from my system, with my comments about
what I've tried underneath (I doubt this will 'tab' well in everyone's email
client):
 
session.auto_start 	Off	Off 	; tried both on and off
session.bug_compat_42	On On		; tried both on and off
session.bug_compat_warn	On On
session.cache_expire	180 180
session.cache_limiter	nocache nocache
session.cookie_domain	no value no value
session.cookie_lifetime	0 0
session.cookie_path	\ \
session.cookie_secure	Off Off
session.entropy_file	no value no value
session.entropy_length  0 0
session.gc_divisor	1000 1000
session.gc_maxlifetime  1440 1440
session.gc_probability	1 1
session.hash_bits_per_character 5 5
session.hash_function	0 0
session.name   		FOOBAR FOOBAR	; originally running as PHPSESSID -
shouldn't matter anyway
session.referer_check  	no value no value
session.save_handler	files files
(*)session.save_path		C:/Documents and
Settings/Administrator/Local Settings/Temp/php C:/Documents and
Settings/Administrator/Local Settings/Temp/php

session.serialize_handler php php
session.use_cookies  	On On
session.use_only_cookies Off Off
session.use_trans_sid  	0 0
 
 
 
* session.save_path - (no, the star is not in my php.ini file) I've had the
save path at c:\temp, c:\tmp and the entry above.  I've had all of the
slashes in both directions '\' and '/' with no luck (I'm not even sure which
one is right anymore).  I've set permissions on all of the directories, and
their parents to "full control" for "Everybody".  Like I said earlier, the
file is getting written, it is just not being read back in.

Ok, here is my PHP test code.  Works fine on Linux:

<?php
session_start();
// Use $HTTP_SESSION_VARS with PHP 4.0.6 or less
if (!isset($_SESSION['count'])) {
  $_SESSION['count'] = 0;
} else {
  $_SESSION['count']++;
}

print "Counter=".$_SESSION['count'];

print "<br><a href=session_test2.php>Go to page 2</a>";

print "<br><a href=session_test_delete.php>Clear Session</a>";

?>

I also notice the data in the session file isn't encrypted in any way.
Should it be?  I would think it would be at least base64 encoded....

Any suggestions greatly appreciated - this is very frustrating!

Thanks,

Tom

http://www.liphp.org






More information about the talk mailing list