I would like to knock up a phpbb forum with a rails application. I wanted to do this as I want to use ActiveRecord to crawl through the user database in the rails app. Is there a way to do this - on the same domain name and server... Or does it depend how the server is setup?
on 2006-05-30 18:44
on 2006-05-30 20:29
I think it depends on how the server was setup. Are you using shared hosting or do you have a dedicated server and what is the setup for rails and for php on your server? I did something like this before - where I had a php app and rails app sharing the same database. What I did was... -setup apache with mod_proxy and php and use it to serve the php files as normal. -setup lighttpd to run the rails app on a higher port -setup apache virtual hosts to proxy requests to the rails app or directly serve the php pages depending on the url. cheers, AF
on 2006-05-31 04:16
Okay, I see what you mean now. I wasn't entirely sure but I think I understand that there are several ways to go around this, one of them is your method. Another one would be to declare several fastcgi.server in lighttpd for different subdomains. I just read up on reverse proxying with Apache (I haven't done anything like this before) and it seems I can do a ProxyPassReverse and point /foo/ to a subdomain that has been setup (presumebly a virtual host which points to the lighttpd server?) - which solves the problem of not wanting a subdomain. Am I on the right lines? Also, wouldn't it be easier if one declares all those in the lighttpd config? How would I host it on lighty, again, without subdomains? Would it be proxying again (with lighty, of course)? Many thanks.
on 2006-05-31 13:55
i just finished integrating this and it took some time. Someone here on the list wrote up a really nice page on the wiki about it which helped a great deal. I spent a good deal of time working with sessions mostly. What i ended up doing was making my sessions table the phpbb sessions table (phpbb_sessions) and making the session_id cookie the same as phpbb for rails and phpbb so that if i logged into my rails app i was already logged into the forum, and vice versa. I then setup a before_filter in application.rb to check for, say a phpbb cookie to then load the session data like this ....... elsif cookies[:fscookie_sid] && session[:user].nil? sess = Session.find_by_session_id(cookies[:fscookie_sid], :include => "user") if sess && sess.session_user_id > 1 session[:user] = Hash.new session[:user] = sess.user.attributes session[:zip] = session[:user]["zipcode"] setlocation(session[:zip]) && setdeflocation if session[:zip] session.model.session_user_id = sess.user.user_id session.model.session_ip = encode_ip session.model.session_time = Time.now session.model.session_logged_in = 1 elsif sess && sess.session_user_id == 0 session.model.session_user_id = 1 end end One thing I did notice is that for some reason the default value of '1' wasnt being used in the database, so I had to manually set the user_id to 1 if it was a "guest" user. Still havent figured out why. If you need any more help you can find me on the rails webchat at http://www.railswebchat.com adam ----------------------------------------- http://www.railswebchat.com