We have an old legacy PHP application. Now I want to write a new app module using Ruby on Rails.
Deployment is a problem I think it is possible to run a PHP app (via mod_php) and ROR app (via mod_proxy / mongrel) on an Apache server, because I do not want to use mod_rails To run the phc it is necessary to walk through fcgi so there is a danger of breaking both PHP and ROR will use the same DB.
The hard part is how to pass login information from the PHP application to the ROR app. Users enter PHP and their information is stored in PHP session data. The ROR app will be placed in a subdirectory of the main PHP app (such as www.example.com/railsapp) then the ROR should get all the HTTP cookies and the question is how is the PHP session to remove the session data from the ROR app.
Since then this is just my first thought, which is bad due to possible conditions between PHP Mod and ROR. I can modify the PHP app to store some information in DB, when a user logs in. But I do not know how to handle the case when PHP session data expires, and some data should be updated in DB (user logging out)
Does anyone solve such a problem? Or at least one of the most promising directions can indicate?
Update: It is possible to configure mod_php to store session data in SDL DB so there will be no running conditions in such a way that the DB engine should stop running conditions.
Update2: Actually it is possible to use mod_rails with Apache in pre_forf mode. Which is required by mod_php Task Manager to run Apache in MP3 mode it is recommended only for mod_rails. So all the deployment of PPA / ROR apps has been very simple.
First of all, if you are keeping the rail app it is possible to use this mod_rails in a sub directory In your configuration for PHP site you may have a location that has a route to rail.
& lt; Location / railsapp & gt; DocumentRoot /.../app/public & lt; / Location & gt;
To get a session towards the rail side, you can either create a connected page on the rail and call it from the PHP side and log in some data . You need to protect this page from any request not from local host.
You can also switch the rail to use a database to store your sessions, you should be able to generate a session ID, with the correct name and secret in the cookie Store, and manually create sessions in the database from that ID.
You (which I recommend) can also log on to the proxy page of the railway party in the user and redirect them to their desired page.
$ key = md5hash ($ $) User_id $ User_password_hash. $ Timestamp) $ url = "/ railsapp / proxy? Userid =". $ User_id "& Amp; key =" $ Key "& Amp Page = Home% 2 Report" & lt; A href = "& lt; $$ url $ & gt; & Gt; Rail app & lt; / A & gt;
Rail
map.proxy 'Proxy' ,: admin = & gt; 'Proxy' ,: Action = & gt; 'Connect' classic proxy controller & lt; ActionController :: Base Df Connect Key = ... if Parameters [: Key] == key login_surf [[UserID] redirect_to Parameters [: Page] and render: nothing ,: position => 403 End & End
Comments
Post a Comment