NYCPHP Meetup

NYPHP.org

[nycphp-talk] simple problem with sessions

Aaron Fischer agfische at email.smith.edu
Fri Oct 8 21:51:40 EDT 2004


I'm having trouble getting sessions to work on a new server.  At this 
point I have tried to back my code down to the simplest use of sessions 
that I can think of, but still to no avail.  My hosting company hasn't 
been much help to date.  I'm wondering if the following code should 
work?  (The server is running PHP 4.3.6.)

first page:

session_start();
$_SESSION['user'] = "Frank";
header("Location: full_url.php");

second page:

session_start();
echo $_SESSION['user'];

also later on in this page:
<pre><? print_r($_SESSION); ?></pre>

The output produces nothing reflected from the echo statement and the 
print_r produces an empty array:
Array
(
)

I'd appreciate any tips or pointers.  I use sessions a lot on my usual 
server so I'm at a loss as to why the same code isn't working on the 
new one.

Thanks,

-Aaron




More information about the talk mailing list