Okay, I've been having some strange problems using PHPlib 7.4-pre2's
fallback mode. On any page where I used Sessions, the first time I visit the
site, I would get a blank page, but then, upon reloading, everything would
proceed normally. This would happen even when cookies are enabled on the
browser.
So, I did some debugging with Proxomitron's HTTP header log, and found that
on the first try, the server responded with:
+++RESP 3872+++
HTTP/1.1 302 Found
Date: Tue, 06 May 2003 19:26:21 GMT
Server: Apache/1.3.6 (Unix) PHP/3.0.12
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Last-Modified: Tue, 06 May 2003 19:26:21 GMT
Cache-Control: post-check=0, pre-check=0
Pragma: no-cache
Status: 302 Moved Temporarily
Location: http://?SP_Session=3a337518caec67dfd76eefb99ff1c856
Set-Cookie: SP_Session=3a337518caec67dfd76eefb99ff1c856; path=/
Transfer-Encoding: chunked
Content-Type: text/html
+++CLOSE 3872+++
instead of the expected HTTP/1.1 200 OK. The second try, as noted, worked
fine.
Looking through the source to session.inc, I found that fallback mode uses a
redirect to add the session to the get query string (see lines 417 to 437 of
session.inc):
header("Location: " . $PROTOCOL . "://" .
$HTTP_SERVER_VARS["HTTP_HOST"] . $this->self_url());
However, on my system (PHP 3.0.12 with Apache 1.3, although I have also seen
the same behavior on another server with PHP 4.2.2 and Apache 2.0) it
appears that the $HTTP_SERVER_VARS is always empty, thus PHPlib is unable to
construct a proper URL to redirect to. I worked around this problem for now
by disabling fallback mode for now, and I imagine that if I had some more
time to work it out, I could find a more suitable fix (which is one of the
reasons I'm asking this).
So, my questions are:
1) Why does fallback mode get invoked even when cookies are enabled?
2) Does anyone know what would keep $HTTP_SERVER_VARS from being populated?
I checked with phpinfo() and PHP is aware of all of the necessary values,
but for some reason they don't make it to $HTTP_SERVER_VARS. The PHP
documentation doesn't mention anything that seems applicable, but I might
not be looking in the right place.
Thanks in advance.
_________________________________
Nathaniel Price <np...@te...>
Webmaster
|