Rails & PHP


#1

Hi there - I wanted to know if anyone has used Rails & PHP on the same
production server and whether they’ve experienced any problems.

I’m looking to install rails on our production soon, however I would
like to know if there are any issues I need to be aware about.

Many thanks,

Jared.


#2

Hi,

Jared T. <jared.telling@…> writes:

Hi there - I wanted to know if anyone has used Rails & PHP on the same
production server and whether they’ve experienced any problems.

What do you meen by “the same production server”? Are Rails and PHP
going to run
in different processes on the same machine? This should be no problem.
Are they
going to run behind the same HTTP server? Which?

Regards


#3

Hi - not sure why i said production - i just mean on the same server. We
currently develop our sites in PHP and would like to start developing
new projects in Rails, once we’re up to spead on it. We’re going to have
to run both our php and rails sites on the same server so I wanted to
know if this is possible and whether there’s any conflicts between them.
I’d assume they’d both run on apache and access mysql.

Hope this makes sense.

Cheers - Jared.


#4

Lighttpd web server can allow some requests to go to Rails and others to
go to PHP, and others to deliver static content. Have a look at a
lighttpd.conf file.

Jared T. wrote:

Hi - not sure why i said production - i just mean on the same server. We
currently develop our sites in PHP and would like to start developing
new projects in Rails, once we’re up to spead on it. We’re going to have
to run both our php and rails sites on the same server so I wanted to
know if this is possible and whether there’s any conflicts between them.
I’d assume they’d both run on apache and access mysql.

Hope this makes sense.

Cheers - Jared.


#5

thanks - the only thing is we have a dedicated server and it’s all
config’d with apache - im not that experienced with servers so im not
sure how easy it will be to install lighttpd - ill check it out though.

cheers.


#6

Just to keep things simple I used two IP’s and bound the PHP stuff to
one IP and the other to Rails. In my case I’m using Apache for the
PHP stuff and Lighttpd for the Rails stuff.

Michael


#7

Rails is essentially a collection of CGI scripts, so there’s no reason
PHP
and Rails can’t coexist. The way I’ve done this in the past is that I’ve
set
up my Rails app somewhere away from my document root, and created a
symbolic
link to the Rails app’s public folder from my docroot.

http://mydomain.tld/addressbook/.So if I create the symlink
“addressbook” in
my docroot /home/ddemaree/web/public, pointing to my Rails app in
/home/ddemaree/web/addressbook/public, I can access my Rails app at

Everything else on that domain can be static content, PHP, whatever you
like, and the Rails files can still be managed separately from the
PHP/static files. This is just a simple, clean way to run a Rails app
and
other sorts of web content under the same virtual host.

  • DD

On 3/28/06, Jared T. removed_email_address@domain.invalid wrote:

Lighttpd web server can allow some requests to go to Rails and others to
I’d assume they’d both run on apache and access mysql.

David D.
Owner and Web Chef, Practicalmadness
removed_email_address@domain.invalid


#8

Interesting…

Have you ever done the reverse?
That is having the domain.com/ being the rails app such as typo and
then making domain.com/forum to be a php forum app?

Wondering if you could use the apache alias functions to do it or if
there are more elegant solutions.

On 3/28/06, David D. removed_email_address@domain.invalid wrote:

Everything else on that domain can be static content, PHP, whatever you

go to PHP, and others to deliver static content. Have a look at a
know if this is possible and whether there’s any conflicts between them.



#9

Hi Michael,

Sounds interesting! Cheers for the info.

J.


#10

Jared,
My company is in the same position as yours. We had a dedicated
box
with all of our PHP and Apache stuff set up and didn’t want to introduce
any
breakage or conflicts. While many people recommend setting up lighttpd
and
proxying from apache to lighthttpd that seemed like too much
administration
and two web servers == 2 times the possible breakages. We installed
SCGI
and have been happy with the results that we are getting. It runs well
with
Apache and seems to serve up rails pages just as fast as mod_php does
PHP
pages.

Rob
http://www.migrob.com


#11

I’ve never tried it personally, but there’s no reason it couldn’t be
done.
You’d have to fuss with the .htaccess or lighttpd.conf file, however, to
explicitly “escape” that path from Rails routing.

In .htaccess, I’d add this rewrite rule immediately after RewriteEngine On
(assuming that the forum is set up in /forum, either as a symlink or –
what
the hell – actually living inside your Rails app’s public folder):

RewriteRule ^forum/.*$ - [QSA,L]

In lighttpd.conf, you’d need to add an $HTTP[‘url’] block that routes
requests for /forum to your PHP forum software; I don’t know the
syntax
off the top of my head but it’s not very complicated to do this.

The main difference between doing this under Apache vs. lightty is that
you’ll have to set up lighttpd to handle the forum scripts as PHP
(especially if you want to take advantage of fastcgi), whereas Apache
should
be able to pick right up with no further configuration.

  • DD

On 3/28/06, Jon Gretar B. removed_email_address@domain.invalid wrote:

On 3/28/06, David D. removed_email_address@domain.invalid wrote:
to

it will be to install lighttpd - ill check it out though.
Jared T. wrote:

removed_email_address@domain.invalid
David D.

Jon Gretar B.


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

David D.
Owner and Web Chef, Practicalmadness
removed_email_address@domain.invalid


#12

Hi Rob,

Thanks for the info - that sounds like a really interesting option,
which I’ll look into.

Cheers,

Jared.


#13

I’m serving PHP directly through Apache (mod_php) and Rails using
lighttpd
behind the Apache port forward. The idea of symlinking is great, except
that
the PHP and Rails apps are running on two different server processes.

Is there something I’m missing? Being able to softly transition PHP
sites
would really rock.

Thanks

View this message in context:
http://www.nabble.com/Rails-PHP-t1354135.html#a3640846
Sent from the RubyOnRails Users forum at Nabble.com.