Problems with Session and Cookies (IIS/PHP4.3.x)
| From: | Steve Jones | Date: | Mon, 07 Apr 2003 17:10:56 +0000 |
| Subject: | Problems with Session and Cookies (IIS/PHP4.3.x) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-142723@lists.php.net to get a copy of this message | ||
I've been trying to get sessions working on my system and find that a
new session ID is created for each page I visit. Attached to the end of
this message is some test code and the information about my system. The
example code fails with the message "PHP Notice: Undefined index: MyName
in c:\inetpub\wwwroot\diskfilerw2\test2.php on line 3"
I've also tried turning register_globals on and then using the
session_register() syntax but get similar results.
I've tried several versions of PHP including the current stable SNAP
(4.3.2.2). I've also tried both IE (6.0.2800.1106) and Netscape (7.01)
browsers.
I've also determined that setting and retrieving cookies is not working.
I'm guessing non functioning cookies and non functioning session
variables are symptoms of the same problem. I've tried relaxing the
browsers cookie settings to allow anything and also to tighten the
settings to allow nothing or to be prompted. None of those settings
worked and when configured to prompt I wasn't prompted to accept a
cookie.
Any guidance will be greatly appreciated.
Best regards,
Steve Jones
stevendalejones@earthlink.net
test1.php
<?
session_start();
$_SESSION["MyName"] = "John Doe";
header("Location: test2.php");
?>
test2.php
<?
session_start();
echo $_SESSION["MyName"];
?>
Error Message:
PHP Notice: Undefined index: MyName in
c:\inetpub\wwwroot\diskfilerw2\test2.php on line 3
Computer Information:
Windows 2000 Service Pack 3
IIS
php 4.3.1
Relevant sections of php.ini file:
[PHP]
engine = On
short_open_tag = On
asp_tags = Off
precision = 14
y2k_compliance = On
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func=
allow_call_time_pass_reference = Off
safe_mode = Off
safe_mode_gid = Off
safe_mode_include_dir =
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_
safe_mode_protected_env_vars = LD_LIBRARY_PATH disable_functions =
expose_php = On max_execution_time = 30 max_input_time = 60 memory_limit
= 8M error_reporting = E_ALL display_errors = Off
display_startup_errors = Off log_errors = On log_errors_max_len = 1024
ignore_repeated_errors = Off ignore_repeated_source = Off
report_memleaks = On track_errors = Off variables_order = "GPCS"
register_globals = Off register_argc_argv = Off post_max_size = 8M
gpc_order = "GPC" magic_quotes_gpc = Off magic_quotes_runtime = Off
magic_quotes_sybase = Off auto_prepend_file = auto_append_file =
default_mimetype = "text/html" doc_root = user_dir = extension_dir = ./
enable_dl = On cgi.force_redirect = 0 file_uploads = On
upload_max_filesize = 2M allow_url_fopen = On default_socket_timeout =
60
[Session]
session.save_handler = files
session.save_path = c:\php\sessiondata
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_dividend = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = 0
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
url_rewriter.tags =
"a=href,area=href,frame=src,input=src,form=fakeentry"
Steve Jones
stevendalejones@earthlink.net
http://home.earthlink.net/~stevendalejones
Provident Technologies - 970-310-8994