View Full Version : cant start sessions!
stealthelephant
10-07-2003, 06:38 PM
anyone know how to enable sessions with php for apache?
i am on a box where the sessions dont start, i do the very most simple scripts
eg
<?php
session_start();
$_SESSION['test'] = "just a test value";
echo "session variable set to $_SESSION['test']";
?>
<a href "next.php">next</a>
//next.php
<?php
session_start();
echo "session variable is $_SESSION['test']";
?>
anyone have any ideas what i have forgotten? even text examples come up empty handed
freddycodes
10-07-2003, 06:42 PM
Are you positive that sessions are not working? Is there an error?
Have you tried looking to make sure there is a session id
<?php
session_start();
print session_id();
?>
stealthelephant
10-07-2003, 06:53 PM
thanks for the speedy reply freddycodes;
i just tried that and it does actually print out sessionids, but the 2 are different
stealthelephant
10-07-2003, 06:59 PM
i have put in
<a href="link.php?<?=SID?>">
to pass the session id along and the 2 print out the same, was i supposed to be using cookies for the previous example?
now i gotta figure out why the variable didnt come over
stealthelephant
10-07-2003, 07:29 PM
ok, im a little lost
if i print out something then call session_start() im supposed to get an error right? but i dont....
freddycodes
10-07-2003, 07:40 PM
Yeah that is strange. Do you have a phpinfo() page I could look at?
stealthelephant
10-07-2003, 07:50 PM
yeah thanks,
its in the zip file;
current environment is
winxp, dreamweaver, vmware -> slackware if that makes any difference
freddycodes
10-07-2003, 08:45 PM
Well one thing is your session.save-path is set to /tmp which of course does not exist on WIndows. But this should throw an error. You should make a folder C:/tmp and change the path to that in the php.ini file. Then restart the web server. On the linux box it should be okay at /tmp
stealthelephant
10-07-2003, 09:11 PM
thanx, will give that a shot tomorrow, time for sleepies at the moment :o
stealthelephant
10-09-2003, 11:58 AM
got it working on both boxes
thanks for the help
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.