Forum: Ruby on Rails PHP & Ruby -- Rendered to One Page

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
8381341c6fd51ae7935835c48dcfd282?d=identicon&s=25 Bill (Guest)
on 2007-06-25 07:44
(Received via mailing list)

I've been looking through these boards and the Internet at large for
the last few hours trying to determine if it's possible to render a
single page that has both PHP and Ruby elements in it.  Specifically,
I am setting up a RoR site, but there are a couple pre-made PHP
modules I've found that could handle code we would otherwise have to
write from scratch in RoR, so I would like to incorporate these
modules into a few pages alongside the RoR elements (yes, I know
managing the sessions, etc. will be a pain).  While there is a wealth
of information about setting up a single server that can serve both
PHP and RoR pages, these seems to be little that discussion about the
possibility of a single page request running both PHP and RoR code?

Does anyone know if this is possible, and how?  Performance is a
consideration, as I am trying to create a page that gets users real
time information.

Thanks for any help,
689107856b5a794181624031eb6df776?d=identicon&s=25 (Guest)
on 2007-06-25 08:12
(Received via mailing list)
Have you looked stuff about invoking command line programs from with
rails? That way you might be able to call the php interpreter and get
the result as text.

Also, have you checked if their are any ruby gems that do what the php
libraries do?
9a2a53db8e9b4476038c94a64b32833f?d=identicon&s=25 Ryan Bigg (Guest)
on 2007-06-25 09:33
(Received via mailing list)
What is so important in PHP that you cannot possibly spend time
converting it into Ruby?
2808b5c359edcb77ec783e3793c8d381?d=identicon&s=25 Rafael (Guest)
on 2007-06-25 10:46
(Received via mailing list)
Hi Bill,

I combined Typo3 as a CMS and several Railsprojects.
The best solution for me, is to grab the page, what I need.
I do that with open-uri and hpricot.
Take a look @

May be, this could be a solution for you?
What do you want to do exactly?


A0f6b57661bc57b6520010a2a333faba?d=identicon&s=25 R. Elliott Mason (eleo)
on 2007-06-25 10:53
Hm, I would have thought PHP included in a view would be interpreted.
That's probably a stupid notion and apparently untrue.
34a7615f38496a5dafbb3e6b721c435e?d=identicon&s=25 Mohit Sindhwani (Guest)
on 2007-06-25 10:54
(Received via mailing list)
Rafael wrote:
> regards
> Rafael

Hi Rafael

That sounds interesting, but doesn't that increase the network data
transfer for your application and then possibly have an impact on the
performance?  If I understand what you say, you have multiple
applications running simultaneously (on different ports/ directories)
and then use hpricot to get the results from the views of these other
projects (Typo) and display them on the output of your Rails app?

Could you share more details?  It does sound interesting...

6/25/2007 | 4:54 PM.
2808b5c359edcb77ec783e3793c8d381?d=identicon&s=25 Rafael (Guest)
on 2007-06-25 11:20
(Received via mailing list)
Yes sure, may be you're interested why my thoughts to combine.
IMHO, at the moment, there isn't either an Enterprise Rails CMS nor it
wont be.
Typo3 is serving all our needs in a normal Webproject - Day, but what
when I want to make a nice webapp?
That's where RoR comes in :-)
I like Ruby AND Rails much more then PHP and PHP MVC solutions, what
I've seen.

I went quite long for this solution. Finally its quite easy, but you
have to consider somethings:

- You have to have is full access to your webserver, because, shared
hosting is not nice here.
- Best is running the Typo3 CMS or lets say, the PHP on the same
- To increase performance, you can cache or generate the page you

A) Performance
I think performance is absolutely ok, the page which comes out from
typo3 is cached at the moment
May you want to take a look:

B) Integration
I go with a apache mod_proxy solution
I have a balancer/cluster with 3 Mongrel instances started.
the mod proxy roule takes the name of the html from typo3 and
translates it to the rails route.

What you think? May be you have also some ideas, how to go further?
At the moment this solution is more or less temporary, it works but I
really want to optimize it.


34a7615f38496a5dafbb3e6b721c435e?d=identicon&s=25 Mohit Sindhwani (Guest)
on 2007-06-27 03:23
(Received via mailing list)
Rafael wrote:
> have to consider somethings:
> typo3 is cached at the moment
> What you think? May be you have also some ideas, how to go further?
> At the moment this solution is more or less temporary, it works but I
> really want to optimize it.
> regards
> Rafael

Hi Rafael,

Thanks for the information - it does sound interesting.  I am thinking
of something similar but haven't yet been able to decide which way to
go.  I do quite like Radiant and that may be the CMS behind the site.
There is also a project called RadiantOnRails which aims to allow easier
integration by making it a plugin.

Let's see which way it goes!

6/27/2007 | 9:22 AM.
0fb470ceed5e8b2e4a251dce38dbc3b7?d=identicon&s=25 isopaleocopria (Guest)
on 2007-06-27 20:02
(Received via mailing list)
Another possibility might be to use JRuby to run your rails app, and
Quercus to run the PHP. Both can be deployed to an application server
as Java WARs (web archives). In this scenario, your Rails app and PHP
app are both running as separate servlets. When your Rails app invokes
a URL on the PHP app, I believe that the communication is handled
directly by the application server.

// Gregory
This topic is locked and can not be replied to.