Page 1 of 1

session does not work

Posted: Thu Jul 10, 2003 2:58 am
by Brakanjan
Session does not work on my local webserver (code has been tested successfully on other webserver)

any possible reasons?
(i have php4)

These are my phpinfo stuff, which looks right?

Session Support enabled
Registered save handlers files user

Directive Local Value Master Value
session.auto_start Off Off
session.bug_compat_42 Off Off
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 /dev/urandom /dev/urandom
session.entropy_length 16 16
session.gc_divisor 1000 1000
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 /tmp /tmp
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies On On
session.use_trans_sid Off Off

Posted: Thu Jul 10, 2003 3:34 am
by qartis
Is /tmp a valid directory? Session autostart is off, so are you session_srat()ing before all scripts? Can we see the code you were trying?

EDIT: Also, dies php give any errors, even with E_ALL?

Posted: Thu Jul 10, 2003 4:23 am
by Brakanjan
tmp is certainly not a valid directory, where should it be set?

the code works fine over on my ISP, here's chunks of it:

page1.php:

<FORM METHOD="POST" ACTION="page2.php">
Enter your Name: <input type="text" name="name">
<input type="SUBMIT" value="Submit">
</FORM>

page2:

session_start();
$name = $_POST['name'];
session_register('name');
$_SESSION['name'] = $name;

page3:

<?php
// start the session
session_start();
Hallo <? echo $_SESSION['name']; ?>

Posted: Thu Jul 10, 2003 7:57 am
by qartis
The code works on your ISP's server, but it's not working on your local PHP (in WIndows, I'm guessing)? If that's the case, then edit php.ini, and change session.save_path to a temp directory (c:/temp will do) and double-check that it's a real directory :)

Should work, if not then tell us the error.

Posted: Thu Jul 10, 2003 8:11 am
by Brakanjan
stupid me :x

tx!