perl and php inside rails

Ok, I know this sounds weird, but I have a client who has some perl and
php things already written that they want to use. I don't really know
much about either of these languages, so I just assumed I could throw
them in the public directory and post to them through a form by calling
the script name. That didn't work. I read a few different posts that I
need to setup a cgi-bin folder. So, I made the new folder in my railsapp
root directory, then put the scripts in there. When I put

<form action="form.pl">... this gives my a 404 error. How can I make
that form work? Do I need to add a .htaccess into my public folder that
does some sort of rewrite or something?

Thanks for the help,

~Jeremy

? If you're literally putting that in a directory called "cgi-bin" then the
value for action would be "/cgi-bin/form.pl".

But you may need to configure cgi-bin completely differently (and
*outside of* your rails app) depending on what server you're using.

If you're using Apache httpd, reading the comments in httpd.conf is
probably a good first step :slight_smile:

Thanks for the response. Yeah, I was putting it in a folder called
"cgi-bin" that is located inside my application root folder. When I
would post to it using <form action="/cgi-bin/form.pl" method="post"> it
would just give me a 404.

I decided to drop the perl, and just focus on PHP. I found a similar
script done in PHP.

http://www.dtheatre.com/scripts/formmail_doc.php

I have these static html files in my public folder. In these html files,
they have forms that I need to post to formmail.php.

I just keep getting a 404 saying it doesn't exist. Any ideas?

Server setup is:
Slackware
Apache 1.3
Mongrel
php 5.2
Rails 2.3.2
Ruby 1.8.7

~Jeremy

Hassan Schroeder wrote:

Alright, where *exactly* is formmail.php?

But actually, if it were me -- I would bypass a lot of probable grief
by creating a virtual host, e.g. scripts.example.com, just to run the
PHP/cgi/whatever other stuff independently of your Rails install.

Then set your action="http://scripts.example.com/formmail.php",
tickety boo and bob's y'r uncle :slight_smile:

FWIW,

OMG, lol. This whole thing is a huge mess. The actual server
administrator doesn't know how to do anything on it. I had originally
suggested doing that, and he goes "I don't know how, can you do it?".
This is for a place here in vegas, and they have weird rules
about how
things have to be done. I don't know how to create a subdomain on their
site, and neither do they >.<

The *server administrator* doesn't know how? Madre de dios.

It's so trivial. Seriously, look at the comments in httpd.conf. That's
enough for most stuff, and if not, the Apache httpd documentation
is very nice. Read both.

The formmail.php file is in the public folder. It was suggested by a
friend of mine that I create a subfolder like "stupid_php_scripts" and
then tell mongrel to ignore that folder since everything is being
proxied through mongrel. then I would post to
"/stupid_php_scripts/formmail.php". The only thing is that I don't know
how to tell mongrel to ignore some fodlers or files.

I don't know either, but I'd bet it would be easier to configure httpd
to *not* proxy `/stupid_php_scripts/*` to mongrel.

I guess all I can say is good luck :slight_smile: