Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > anyone gotten adodb db sessions going?

anyone gotten adodb db sessions going?
Thread Tools
deuce868
Fresh-Faced Recruit
Join Date: Oct 2005
Status: Offline
Reply With Quote
Dec 2, 2005, 11:08 AM
 
I have setup adodb sessions on a php4 host and a php5 host to share the same db. The db connection is all done with adodb and works fine. The sessions are created, but they do not follow the user between hosts as intended. They are getting separate session ids. I am wondering if this has to do with the way the globals are used in the session code? I had to define several variables as global and then set them on the php5 system in order for the code to work out.

So far I have assigned the code below. Is there anything else I might be missing causing these sessions to not work with PHP5?

[ I define these before requiring the adodb-session file and then after including the file I run session_start()]



global $ADODB_SESSION_DRIVER;
$ADODB_SESSION_DRIVER = 'mysql';

global $ADODB_SESSION_CONNECT;
$ADODB_SESSION_CONNECT = dbserver;

global $ADODB_SESSION_USER;
$ADODB_SESSION_USER = dbuser;

global $ADODB_SESSION_PWD;
$ADODB_SESSION_PWD = dbpassword;

global $ADODB_SESSION_DB;
$ADODB_SESSION_DB = dbname;

global $ADODB_SESSION_TBL;
$ADODB_SESSION_TBL = sessions

global $ADODB_SESSION_EXPIRE_NOTIFY;
$ADODB_SESSION_EXPIRE_NOTIFY = null;


Thanks for the help.
     
deuce868  (op)
Fresh-Faced Recruit
Join Date: Oct 2005
Status: Offline
Reply With Quote
Dec 2, 2005, 03:08 PM
 
Ok, I made some progress. I found that because the two servers have different urls I should set the cookie domain to the domain and that way they can be different subdomains ok.

That seems to be working. I now only get one session with the same session ID. The trouble I am having now is that with the adodb sessions I cannot retrieve the data from the previous server. It's in the db, and I can see it. I just get an empty array.

Any ideas as to what else I might be missing?

Thanks
     
jay3ld
Senior User
Join Date: Jul 2004
Status: Offline
Reply With Quote
Dec 2, 2005, 07:37 PM
 
if the second domain is on another server than the first you need to setup mysql to allow the second server to connect to its mysql database
     
deuce868  (op)
Fresh-Faced Recruit
Join Date: Oct 2005
Status: Offline
Reply With Quote
Dec 2, 2005, 07:47 PM
 
That all works. They both read data from the same db. Before I set the cookie domain in the php.ini on both servers both servers would set sessions with separate session ids in the same db table. So I'm sure the db part is working.
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 10:16 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,