
Andy Kay - 2008-02-03 02:27:42
Please help me figure out why I can't get cookies set up.
I recently changed my site to use sessions stored in a database. BTW, I'm on a shared server running PHP Version: 4.4.7 and MySQL Version: 5.0.30.
I made the following changes; session.use_cookies: On
session.use_only_cookies: On
session.use_trans_sid: Off
Now. I observed the following.
Firstly, session id is recreated everytime I visit the page which has session_start(). Secondly, the session is only valid in the current page. Subsquent page calls (URLing to another page) cannot see the session variables set earlier.
- For a minute I accepted that I can live with that but then - it's back to the drawing board.
Finally, the main problem. Not Cookies are being created.
I tried:
setcookie("suidone","doh");
echo "ck1:" . $_COOKIE['suidone'];
$lifetime = time() + 1440;
setcookie("suidtwo", session_id(), $lifetime,"/","blessedwithoutlimits.com");
if (isset($suid))
echo "ck2:" . $_COOKIE['suidtwo'];
None of these creates a cookie. (Checked using Firefox, Tools->Show Cookies)
Attempts: I have googled on this for 48+ hours and tried several solution to no avail. Tried .htacess too. session.cookie_path and the like.
Please advise what I might be doing wrongly with the whole thing of saving sessions in a database then use the "one" cookie (preserved sesion id) to ID the user during the session.
I would also appreciate if someone can 'clickpoint' me to the right material/place to find help.
Many thanks in advance.
Drew