Home > i.t. > 在Godaddy Deluxe运行Ruby脚本

在Godaddy Deluxe运行Ruby脚本

January 11th, 2008

网上有很多文章介绍怎么在Godaddy的空间上跑Ruby on Rails,但是怎么单独运行Ruby脚本,却很少有提及。和Perl、php相比,Ruby更灵活,更省力。
我们看下面这个例子:

#!/usr/local/bin/ruby -w
# index.cgi
puts "Content-Type: text/html"
puts
puts "Hello World!"

把上面这段脚本上传到Godady的空间里,任意目录都可以。然后将这个文件的属性改为755(大部分FTP软件都能做到)。

这样你就可以看这个脚本运行了,比如:http://www.yoursite.com/main.cgi

注意,脚本的名字一定要以cgi作扩展名,而不是rb。

如果要用gems,可以这样

require "rubygems"
require "mysql"

webflier i.t.

  1. May 13th, 2009 at 00:53 | #1

    CZnM4F tlainvgscana, [url=http://kqhnulmvjqjp.com/]kqhnulmvjqjp[/url], [link=http://arteqgbqgadh.com/]arteqgbqgadh[/link], http://txwlctfutkgk.com/

  2. May 20th, 2009 at 08:53 | #2

    winning edge.com index2.3 ford intake manifolds http://www.spokane county property taxesgerald rudolph ford jr ford 5.7rywells indiana.edu 4.0l 6cyl performancehttp://www.mercyhurst college.com ford 5.8l spark plugsford 4.6l engine tips pres. ford s funeralpod 2.0 tips tricks death jr. 2 cheatsriley.com http://www.cnn.com gerald r. fordford 2.8 v6 j.f.k. presidentg. ford ford 3.0l spec

  3. October 23rd, 2009 at 01:36 | #3

    Use nested styles to dynamically apply complex character formatting to ranges of text within a paragraph. ,

  1. No trackbacks yet.