newbie: rails3 session & access via php

hi,
im having a working rails3 app with devise. on the subdomain (same
server) i have a phpscript which i need to use. i do currently use
cookie stores.
when im not logged into rails, then the output of my php script looks like this:
Array ( [0] => {"_csrf_token"1dbm4TrxUPTLaNA39YtIu92pPoDiNy6pRIrhmwjOYYg0="session_id"%0e4d83ea31b16dd4e2c164671961c073"user_return_to"/home"
[flashIC:%ActionDispatch::Flash::FlashHash{] => [alert"6You need to
sign in or sign up before continuing.] => [@usedo:Set] => [1] =>
@hash{;T ) 1

being logged in, it looks like that:
Array ( [0] => {
["_csrf_token"1dbm4TrxUPTLaNA39YtIu92pPoDiNy6pRIrhmwjOYYg0="session_id"%a1220894b4372e1656768900657e9bdc"warden.user.user.key["
User[i""$2a$10$zDfB1jyHfLOa1LzzkgDLYe"warden.user.user.session{"last_request_atIu]
=> Time ká€ØC©:marshal_with_utc_coercionT"
[flashIC:%ActionDispatch::Flash::FlashHash{:notice"Signed in
successfully.] => [@usedo:Set] => [1] => @hash{;T ) 1

now i guess my question is:
1) how can i associate a user with the phpinformation about the
session? (how does rails do it?
2) should i go with active-record-session-store and add the user_id there?

thx

I think yes. You should store your session to database and access it via php.

u mean no two? and then pass the sessionid via url?
thx

hi, i switched to activerecord store and im using devise.
def after_sign_in_path_for(resource)
  puts "...............................................after_sign_in_path_for"
  puts request.session_options[:id].to_s

i get no session information, althought the code works fine in the view

any ideas?
thx