View Full Version : session problem

05-11-2004, 06:22 PM
hi everyone,

i am a newbie in php and facing a problem regarding cookies.

i have following settings in my php.ini file:

session.save_path = "C:\Program Files\Apache Group\Apache2\htdocs\tmp"

session.use_cookies = 1
session.cookie_lifetime = 0
session.cookie_path = "C:\Program Files\Apache Group\Apache2\htdocs\cookies"
session.cookie_domain =

Earlier i had session.cookie_path = / ------default value, i changed it to the above mentioned cookies directory which is mentioned above.

i dont know where is the default value for / session.cookie_lifetime = session.cookie_lifetime = / / pointing towards.

now i am writing following code:

$val = setcookie("test_cookie","hello");

if($Val == TRUE)
echo "cookie set<br>";
echo "problem setting cookie";

$cookie_val = $_COOKIE['test_cookie'];
echo $cookie_val;

i get the output cookie set

now when i go to cookie tmp directory according to the:
session.save_path = "C:\Program Files\Apache Group\Apache2\htdocs\tmp" ---- i get the files having names like session ids (sess_20d809b36ece8a6c85ebd706532ddefc) when i double click the file and open with notepad i dont get the value which i had set using the setcookie function (i.e. hello).

plz help me knowing how can i access cookies, where are they stored as i do not get any thing in cookies directory which i created for session.cookie_path setting.

why am i not getting the hello value for cookie in the tmp directory session file.

Thank you

05-11-2004, 06:24 PM
That is because you are not using a session, you are using a cookie.

To use a session you use:
$_SESSION['test_value'] = "Hello";