How to integrate a PHP app with RoR app?


#1

I have developed a RoR application and would like add on a feature.
Found a opensource solution (although developed in PHP). I wonder how I
can integrate - they can share the same DB (MySQL) but how about session
variables?

Is there a way the php application and my rails app can share/exchange
the session variables (e.g. user_id, company_id)?

Thanks!


#2

I suppose there would be a way to implement a “single sign-on” system
for your RoR and PHP applications.

As far as sharing session variables, that would likely require some
sort of service in each application to exchange that data.

It’s my understanding that Rail is going to store Ruby objects in
session data. You could write some sort of serializer/deserializer
for reading the Ruby objects out of the sessions table for your Rails
application, and vice-versa for your PHP session data, but that
doesn’t sound like much fun and could be risky.

I would think that creating a web service (RESTful service might be
good) to exchange session data between the apps is more feasible. But
problem one is to implement “single sign-on” so your users will have a
nice experience moving between the two applications.

On Mar 19, 12:06 pm, Gordon Lo removed_email_address@domain.invalid


#3

Robert W. wrote:

doesn’t sound like much fun and could be risky.

can integrate - they can share the same DB (MySQL) but how about session

Also, you can do login from rails and proxy login info to PHP app.
Check this two articles:
http://wiki.rubyonrails.org/rails/pages/HowtosDoSingleSignOnWithPHPbb
http://wiki.rubyonrails.com/rails/pages/ExampleCookieJarHelper

best,
Bojan


Bojan M.
-> Ruby on Rails and Web D. Blog : http://source.mihelac.org