# Embed php code in rails

**URL:** <https://www.ruby-forum.com/t/embed-php-code-in-rails/169537>\
**Category:** Rails\
**Created:** [June 4, 2009, 11:50pm UTC](https://www.ruby-forum.com/t/embed-php-code-in-rails/169537 "2009-06-04T23:50:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shuaib85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@shuaib85](https://www.ruby-forum.com/u/shuaib85)\
**Post date:** [June 4, 2009, 11:50pm UTC](https://www.ruby-forum.com/t/embed-php-code-in-rails/169537/1 "2009-06-04T23:50:13Z")

</div>

Hi there

There are some code pieces that are available in php like currency  
rates, and weather status, etc. Is there a way that I can use those  
php code within rails code in the view. or is there a good rails  
plugin for that purpose

thanks

---

<div class="post-metadata">

**Author:** ![shuaib85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@shuaib85](https://www.ruby-forum.com/u/shuaib85)\
**Post date:** [June 5, 2009, 12:21am UTC](https://www.ruby-forum.com/t/embed-php-code-in-rails/169537/2 "2009-06-05T00:21:51Z")

</div>

On Thu, Jun 4, 2009 at 2:49 PM, Shuaib85 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi there
> 
> There are some code pieces that are available in php like currency  
> rates, and weather status, etc. Is there a way that I can use those  
> php code within rails code in the view. or is there a good rails  
> plugin for that purpose
> 
> thanks

Well, if you have truly looked for similar within the Ruby gems and  
plugin  
repositories and cannot find an equivalent, I would recommend adding  
the functionality to existing gems/plugins or creating new ones. From  
my  
experience, it was simply easier to do it this way unless the PHP and  
Ruby sides code interactions were isolated.

For example, I had to integrate a Word Press blog into a Rails  
application.

This worked great because I just dropped the blog into the public part  
of  
the Rails  
site and I was off to the races. However, this didn’t work so well when  
I  
needed  
to integrate a Rails application with a bank’s billing interface that  
was in  
PHP.  
It simply felt wrong but the client wanted it ASAP and I ended up  
capturing  
the  
users input on the Rails side and submitting it to a PHP confirmation  
page  
for later  
submission to the bank.

In short, if you can find a good isolation point between the two  
languages,  
I would  
use that at a means of integrating the two if you do not have time to do  
it  
all in  
Ruby.

Good luck,

-Conrad

---

<div class="post-metadata">

**Author:** ![shuaib85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@shuaib85](https://www.ruby-forum.com/u/shuaib85)\
**Post date:** [June 8, 2009, 12:46am UTC](https://www.ruby-forum.com/t/embed-php-code-in-rails/169537/3 "2009-06-08T00:46:53Z")

</div>

Conrad, I’m trying to drop Wordpress into the public folder of my  
rails project, just as you said.

Did you have any trouble with the index.php files? Some error is  
causing them to return blank pages.

It’s frustrating, because if I manually type in  
www.satslayer/blog/wp-admin/index.php  
I can see my dashboard, but  
I cannot get www.satslayer/blog/index.php to work for the life of me.

When I make the wordpress site my root, it works. So something in  
rails is causing a php error.

Any idea what’s going on? Oh, and where are the php error log files  
located?

Thank you,

Frank

---

<div class="post-metadata">

**Author:** ![shuaib85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@shuaib85](https://www.ruby-forum.com/u/shuaib85)\
**Post date:** [June 8, 2009, 2:08am UTC](https://www.ruby-forum.com/t/embed-php-code-in-rails/169537/4 "2009-06-08T02:08:03Z")

</div>

removed\_email\_address@domain.invalid wrote:  
[…]

> Oh, and where are the php error log files  
> located?

PHP generally puts its errors into the Apache server’s error log, if I  
remember correctly.

> Thank you,
> 
> Frank

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
