session does not work

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Brakanjan
Forum Newbie
Posts: 19
Joined: Wed May 14, 2003 9:57 am
Location: South Africa

session does not work

Post 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
qartis
Forum Contributor
Posts: 271
Joined: Sat Dec 14, 2002 4:43 pm
Location: BC, Canada
Contact:

Post 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?
Brakanjan
Forum Newbie
Posts: 19
Joined: Wed May 14, 2003 9:57 am
Location: South Africa

Post 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']; ?>
qartis
Forum Contributor
Posts: 271
Joined: Sat Dec 14, 2002 4:43 pm
Location: BC, Canada
Contact:

Post 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.
Brakanjan
Forum Newbie
Posts: 19
Joined: Wed May 14, 2003 9:57 am
Location: South Africa

Post by Brakanjan »

stupid me :x

tx!
Post Reply