I’m trying to run some non-ruby code in my rails app and i’m not sure
how to do this. The code i have would take a really long time to port
to ruby and so i’d rather run it as is (its php). What i would like
to have happen is that the code can be invoked as an ajax call. And
just return some data in JSON.
I keep running into a routing failure by actioncontroller and i’m not
sure how to get around this.
I know its seems terrible to run php inside the rails app, but i’m not
sure what the best solution is here. I’d greatly like some insight on
the best way to accomplish.
On Mon, Aug 07, 2006 at 09:35:08PM -0700, Manish S. wrote:
I’m trying to run some non-ruby code in my rails app and i’m not sure
how to do this. The code i have would take a really long time to port
to ruby and so i’d rather run it as is (its php). What i would like
to have happen is that the code can be invoked as an ajax call. And
just return some data in JSON.
I keep running into a routing failure by actioncontroller and i’m not
sure how to get around this.
This way of working (mixing Rails and legacy code) is quite reasonable,
and
does work (I know, I have a pretty massive app which is slowly being
Railsed
from a base of Large, Hideous PHP). If you told us more about what
you’re
trying to accomplish and what routing errors you’re getting, I’d imagine
that your problem will quickly be pointed out and solved.
I know its seems terrible to run php inside the rails app, but i’m not
sure what the best solution is here. I’d greatly like some insight on
the best way to accomplish.
why? i think its completely ok to do so. its ruby its rails. you CAN
port it
to rails, but if you dont want to, you CAN do it another way. i think
that
sentence was in one of the railsconf keynotes… and i like it.
I’m trying to figure out how to route this request to myscript.php. Is
the right place to do it in .htaccess or should something be done in
httpd.conf?
The exact answer depends on what how you are running rails and php.
The simplest solution is probably just to run apache/php on the same
hostname but a different port. But if apache is already out in front
of your rails app somewhere, you could just use a simple Alias command
or something similar. The solution is fairly simple, but depends on
your exact setup.
I’m trying to figure out how to route this request to myscript.php. Is
the right place to do it in .htaccess or should something be done in
httpd.conf?
Eventually i’ll port the php to ruby, but time is limited right now and
i just need to get something working.
I know its seems terrible to run php inside the rails app, but i’m not
sure what the best solution is here. I’d greatly like some insight on
the best way to accomplish.
why? i think its completely ok to do so. its ruby its rails. you CAN
port it
to rails, but if you dont want to, you CAN do it another way. i think
that
sentence was in one of the railsconf keynotes… and i like it.
I also have a need to run PHP inside my ROR scripts. I want to execute
the code directly in the views though. So far I’ve tried putting <?php
echo ‘test’; ?> right inside the index.rhtml file. After checking the
source code of the rendered page it just shows “<?php echo 'test'; ?>”.
I’ve tested my servers by running a test.php file in /public and that
executes fine.
Does anyone know how to execute PHP inside of the rhtml view?
I’m trying to figure out how to route this request to myscript.php. Is
the right place to do it in .htaccess or should something be done in
httpd.conf?
I also have a need to run PHP inside my ROR scripts. I want to execute
the code directly in the views though. So far I’ve tried putting <?php
echo 'test'; ?> right inside the index.rhtml file. After checking the
source code of the rendered page it just shows “<?php echo 'test'; ?>”.
If you’re serving the app on a mongrel through a proxy to
apache/whatever, you may be able to have apache run php over it. Or,
write a proxy in php and have it eval everything it gets back!
If it’s a long process non-inline thing, I’d toss files into a queue to
be run by cron.
Can you think of anything else? I don’t want to have the overload of
running php over it.
Matthew B. wrote:
Nate wrote:
Hi,
I also have a need to run PHP inside my ROR scripts. I want to execute
the code directly in the views though. So far I’ve tried putting <?php
echo 'test'; ?> right inside the index.rhtml file. After checking the
source code of the rendered page it just shows “<?php echo 'test'; ?>”.
If you’re serving the app on a mongrel through a proxy to
apache/whatever, you may be able to have apache run php over it. Or,
write a proxy in php and have it eval everything it gets back!
If it’s a long process non-inline thing, I’d toss files into a queue to
be run by cron.