1

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

3 Answers 3

3

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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)?

Comments

1

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.

1 Comment

Awesome. Nice solution, but I wanted to ask, if it is a good idea to store loggedin information in a cookie? Are there any security concerns?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.