Re: Debugging a Session Problem
| From: | CPT John W. Holmes | Date: | Fri, 25 Jul 2003 18:05:00 +0000 |
| Subject: | Re: Debugging a Session Problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-156919@lists.php.net to get a copy of this message | ||
From: "Lee Stewart" <lstewart@dsgroup.com>
> I'm moving an application that I'm in the trying to move to a new
> platform. It was running fine on an older Linux platform with PHP
> 4.0.3 and Apache 1.3.14. The new platform is also Linux, with PHP 4.2.2
> and Apache 1.2.26 -- with register_globals on. (I just upgraded it from
> 4.2.2.36 to 4.2.2.69 which is the latest rpm on SuSE's site, with no
> change in the problem.)
>
> The symptom is that when I attempt to save a session variable, it
> creates the session file in /tmp, but with a zero length - no variable
> names or values stored. (/tmp is globally read/write) This happens not
> only with the application I'm moving, but also with the "world's
> simplest global test pages" below.
>
> [page1.php]
> <?
> session_start();
> session_register('test');
> $test='foobar';
> header('Location: page2.php');
> ?>
Seem to remember something about starting a session and then redirecting
with header causing trouble. Try using session_write_close() before you
redirect.
---John Holmes...