# Insert rails into php

**URL:** <https://www.ruby-forum.com/t/insert-rails-into-php/160057>\
**Category:** Rails\
**Created:** [February 11, 2009, 11:37am UTC](https://www.ruby-forum.com/t/insert-rails-into-php/160057 "2009-02-11T11:37:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mokkai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@mokkai](https://www.ruby-forum.com/u/mokkai)\
**Post date:** [February 11, 2009, 11:37am UTC](https://www.ruby-forum.com/t/insert-rails-into-php/160057/1 "2009-02-11T11:37:49Z")

</div>

hi experts,

i have a PHP web application which consists of so much modules (like  
registration,billing,reports,etc…)

i want to convert arround only 60% modules from PHP to Rails, that means  
remaining 40% modules should be in PHP only.

i thing my webserver should be a bridge between rails & PHP application

is there any webserver which can check the request url and send the  
request to rails or PHP accordingly ?

any other idea & help appreciated .

thx

---

<div class="post-metadata">

**Author:** ![mokkai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@mokkai](https://www.ruby-forum.com/u/mokkai)\
**Post date:** [February 11, 2009, 12:52pm UTC](https://www.ruby-forum.com/t/insert-rails-into-php/160057/2 "2009-02-11T12:52:29Z")

</div>

On 11 Feb 2009, at 10:37, Sniper A. wrote:

> i thing my webserver should be a bridge between rails & PHP  
> application
> 
> is there any webserver which can check the request url and send the  
> request to rails or PHP accordingly ?

apache, nginx etc… can certainly forward the request to different  
places based on the url (and other things). Where things might get  
complicated is to what extent your php bits and your rails bits will  
need to share information

Fred

---

<div class="post-metadata">

**Author:** ![mokkai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@mokkai](https://www.ruby-forum.com/u/mokkai)\
**Post date:** [February 12, 2009, 5:43am UTC](https://www.ruby-forum.com/t/insert-rails-into-php/160057/3 "2009-02-12T05:43:49Z")

</div>

Frederick C. wrote:

> On 11 Feb 2009, at 10:37, Sniper A. wrote:  
> apache, nginx etc… can certainly forward the request to different  
> places based on the url (and other things). Where things might get  
> complicated is to what extent your php bits and your rails bits will  
> need to share information
> 
> Fred

thx Fred

i have one more problem  
i want to create subdomain for their profile url accordingly to  
user\_name

for example i have url ([http://localhost:3000/](http://localhost:3000/))

if any person login as “user\_name” then his profile page url should be  
http://user\_name.localhost:3000/

any idea ?

---

<div class="post-metadata">

**Author:** ![mokkai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@mokkai](https://www.ruby-forum.com/u/mokkai)\
**Post date:** [February 12, 2009, 12:13pm UTC](https://www.ruby-forum.com/t/insert-rails-into-php/160057/4 "2009-02-12T12:13:03Z")

</div>

On 12 Feb 2009, at 04:43, Sniper A. wrote:

> thx Fred
> 
> i have one more problem  
> i want to create subdomain for their profile url accordingly to  
> user\_name
> 
> for example i have url ([http://localhost:3000/](http://localhost:3000/))
> 
> if any person login as “user\_name” then his profile page url should be  
> http://user\_name.localhost:3000/

Well I’m not sure how you’d do it in development, but in the real  
world you can setup a wildcard dns entry. There’s a railscast on  
handling subdomains if my memory is correct.

Fred

---

<div class="post-metadata">

**Author:** ![mokkai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@mokkai](https://www.ruby-forum.com/u/mokkai)\
**Post date:** [February 12, 2009, 2:40pm UTC](https://www.ruby-forum.com/t/insert-rails-into-php/160057/5 "2009-02-12T14:40:26Z")

</div>

Hey guys I’ll leave this two links here if you’re interested in  
working with subdomains:

> **[How to do Basecamp-style subdomains in Rails](https://signalvnoise.com/posts/1512-how-to-do-basecamp-style-subdomains-in-rails)**
>
> \# 1) Point \*.example.com in your DNS setup to your server.
> \#
> \# 2) Setup an Apache vhost to catch the star pointer:
> \#
> \# 
> \# ServerName example.com
> \# ServerAlias \*.example.com
> \# 
> \#
> \# 3) Set the current account from the subdomain
> class...

[http://www.robbyonrails.com/articles/2009/01/11/subdomain-accounts-with-ruby-on-rails-explained](http://www.robbyonrails.com/articles/2009/01/11/subdomain-accounts-with-ruby-on-rails-explained)

On Feb 11, 11:43 pm, Sniper A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![mokkai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@mokkai](https://www.ruby-forum.com/u/mokkai)\
**Post date:** [February 13, 2009, 5:26am UTC](https://www.ruby-forum.com/t/insert-rails-into-php/160057/6 "2009-02-13T05:26:24Z")

</div>

Elias O. wrote:

> Hey guys Iï¿½ll leave this two links here if youï¿½re interested in  
> working with subdomains:
> 
> [How to do Basecamp-style subdomains in Rails – Signal v. Noise](http://www.37signals.com/svn/posts/1512-how-to-do-basecamp-style-subdomains-in-rails)  
> [http://www.robbyonrails.com/articles/2009/01/11/subdomain-accounts-with-ruby-on-rails-explained](http://www.robbyonrails.com/articles/2009/01/11/subdomain-accounts-with-ruby-on-rails-explained)
> 
> On Feb 11, 11:43ï¿½pm, Sniper A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

thanks

---

<div class="post-metadata">

**Author:** ![mokkai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@mokkai](https://www.ruby-forum.com/u/mokkai)\
**Post date:** [March 4, 2009, 11:07am UTC](https://www.ruby-forum.com/t/insert-rails-into-php/160057/7 "2009-03-04T11:07:03Z")

</div>

Fred,

Do you think it is possible to have a

 section within a php page  
that can get content from a rails application? I want to keep php as  
the main backbone for the overall application, but have some sections  
get content from rails application. Will appreciate any help.

Thanks  
ravigit

On Feb 11, 6:51 am, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![mokkai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@mokkai](https://www.ruby-forum.com/u/mokkai)\
**Post date:** [March 4, 2009, 11:37am UTC](https://www.ruby-forum.com/t/insert-rails-into-php/160057/8 "2009-03-04T11:37:40Z")

</div>

On 4 Mar 2009, at 00:02, ravigit wrote:

> Fred,
> 
> Do you think it is possible to have a
> 
> section within a php page  
> that can get content from a rails application? I want to keep php as  
> the main backbone for the overall application, but have some sections  
> get content from rails application. Will appreciate any help.
> 
> As I understand things You’ve basically got 3 options - populate that  
> div client side with an ajax request, have an iframe that will make a  
> request to the rails bit or have your php server side code make a  
> request to your rails app and insert the html serverside.
> 
> Fred
