sunwukung Posted January 10, 2009 Share Posted January 10, 2009 Hi I'm having a problem with my sessions. When developing locally, my scripts work fine - but on the server they aren't passing the session data correctly. I'm having to use ini_set to save cookies in a specific directory on the host. When I move to the second script, using a header:Location protocol - it generates a new session that is empty. In a nutshell: //script1......................... ini_set('session.save_path','./session/'); session_start(); $_SESSION['message'] = 'blah'; Then on another page ini_set('session.save_path','./session/'); session_start(); if (isset($_SESSION['message']) { $msg = $_SESSION['message']; echo "$msg"; } else { echo "**** GRRRRRRR!!! AAAAAAAGHG!! the sessions still not working...."; } I've taken a look at using session_name, but while I can figure out how to derive or retrieve a session_name (or session_id), I can't figure out how to force the second script to access the session I want. Link to comment https://forums.phpfreaks.com/topic/140227-solved-multiple-session-problem/ Share on other sites More sharing options...
sunwukung Posted January 10, 2009 Author Share Posted January 10, 2009 Doh!! Managed to solve this one - it's the header. The header uses Location:'http://domainname' - and by omitting the 'www' it is seen as a different/sub domain, thus generating a new session. Link to comment https://forums.phpfreaks.com/topic/140227-solved-multiple-session-problem/#findComment-733762 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.