Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

strange behaviour : session variable/virtual host

Status
Not open for further replies.

vale2

Technical User
Feb 21, 2003
50
FR
Hi,

(sorry if it's a stupid question but i found nothing about this)
i'm running PHP 4.3.5 on redhat 9 apache 2.
I'm testing 2 test scripts (i'm not the writer, i've just configured the server):
##########test1.php########
<?
session_start();
$_SESSION['toto']="TOTO";
echo "<h1>Here test1 : ".$_SESSION['toto']."</h1>"

?>

##########test2.php########
<?
session_start();
echo "<h1>here test2 : ".$_SESSION['toto']."</h1>"
?>


When i use It returns "Here test1 : toto"
When i use It returns "Here test2 : toto" .... nothing special...

but when i use It returns "Here test1 : toto"
and (i don't know why)It returns "Here test2 : "

It seems to loose session variable..
Maybe i'm missing something with configuration or code.
Any idea??
Thanks for your help!
 
Questions & Ideas:
1. How are you storing the sessions? Flat files?
2. Dump out the sessionID to see if it changes when you use the virtual host.
 
thanks for your answer!

sessions are flat files
how can i dump sessionID??
is that config ok?

session.auto_start Off Off
session.bug_compat_42 On On
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 100 100
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path /<file rwx for everyone> /<file rwx for everyone>
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies Off Off
session.use_trans_sid Off Off

am i missing something??
 
after tests :
using ipaddress create only one session file but virtualhost 2... (i don't understand why test2.php create a new file...)
 
I find the problem : it's an IE6 bug...
you could see it :
SYMPTOMS
After you install security patch MS01-055 for Microsoft Internet Explorer 5.5 or 6.0, you may encounter the following problems:
Session variables are lost.
Session state is not maintained between requests.
Cookies are not set on the client system.
Note These problems can also occur after you install a more recent patch that includes the fix that is provided in security patch MS01-055.
CAUSE
Security patch MS01-055 prevents servers with improper name syntax from setting cookies names. Domains that use cookies must use only alphanumeric characters ("-" or ".") in the domain name and the server name. Internet Explorer blocks cookies from a server if the server name contains other characters, such as an underscore character ("_").

Because ASP session state and session variables rely on cookies to function, ASP cannot maintain session state between requests if cookies cannot be set on the client.

This issue can also be caused by an incorrect name syntax in a host header.
RESOLUTION
To work around this problem, use one of the following methods:
Rename the domain name and the server name, and use only alphanumeric characters.
Browse to the server by using the Internet Protocol (IP) address rather than the domain/server name.

i've find it on :
thanks for answering!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top