views:

356

answers:

3

I have a Rails application that uses ActiveRecordStore for sessions. I need a PHP application running on a subdomain to share the session.

I have updated the environment to allow session cookies to be accessed across subdomains, but I don't know what the php application will have to do to access the session data. Please could someone help me out with the next steps?

Thanks in advance

+1  A: 

you need to configure in php.ini where the sessions data are stored. but even after that i am not sure it will work as php / rails probably use different formats for storing sessions.

best would probably be to store variables as JSON in some file that both rails/php can access and then import into both languages (php/ruby-rails)?

dusoft
+3  A: 

I believe the best solution would be to turn handling of sessions over to Memcached for both PHP and Rails. If you write a simple wrapper for each (a number available online actually), then you'll be able to access the same data from either application.

James
A: 

Thanks for the answers guys. Eventually I decided against sharing the sessions themselves, instead opting to share a hashed cookie which both applications could use to verify a user was signed in.

Phil