page77.office
1/4/2006 11:25:00 AM
I am trying to get to grips with ruby as an alternative to PHP.
My plan is to convert a simple PHP application to ruby, as I definitely
like the language better from what I have seen.
I have downloaded instantrails and after adding the missing log
directories, it runs the sample appications, mycookbook and typo.
So now I have mysql and apache running - great - and it was an almost
one-click install.
So now I decide Rails is far too involved for me at my stage of
development and I do not really appreciate what it is doing, other than
providing framework for pages. I am sure it will be very good, but for
now I want to just use ruby as my scripting language for web pages on
an intranet.
I have chosen instantrails, because I wanted Apache and Mysql and
phpMyAdmin, for my current PHP application, I had used WAMP and it
worked seamlessly. I was looking to do the same with Ruby. I suppose
I want WAMR - Windows, Apache, Mysql and Ruby.
I am running Windows XP SP2, but if the project is successful, I will
be moving it to a virtual linux box, using Debian. I am very flaky
with the Linux as I did a bit of UNIX, years ago - but I try.
So to my problem. I have created a 'helloworld' web page and called it
'testcgi.rb'. I have put it in various directories, but whenever I try
to execute it as a web page on my localhost - it just prints out the
contents. I look at httpd.conf and tremble, although I am not sure
which is the right one. I have installed 'instantrails' under
c:\rubyrail
Contents of testcgi.rb
#!/usr/bin/ruby
# HTTP response headers, including double newline
print "Content-type: text/plain\n\n"
# Contents
print "Hello, world from Tim\n"
I suspect it may be something to do with mod_ruby, fastcgi, scgi, but
at the moment as my 'sample rails apps' work, why won't my simple
xxxx.rb execute ?
So how do I get an xxxxx.rb file to execute and where an earth do
rhtml files fit in to the mix.
I appreciate I am probably misunderstanding some fundamental concept,
but having been around computers for 40 years, I like to know how the
nitty gritty fits together.
I have accessed many web pages with howto's etc, but none seem to
answer my questions, so any help or pointers would be greatly
appreciated.
As an aside my testcgi.rb will execute as a ruby script on my virtual
linux with ruby testcgi.rb but not as ./testcgi.rb and my permissions
are 755 - any pointers ?
Thanks
Richard