Of course that the most official way is use ROR(Ruby On Rails).
But it’s hard to build. And here is the easiest way to run ruby from web request.
(The whole passage is based on Debian 4.0 Linux)
First install ruby (for linux)
apt-get install ruby irb rdoc
And creat a new php file as:
1 2 3 4 5 6 | <?php $d = $_GET['d']; system("ruby /rb/$d",$echo); //You may change the direction that you want to put ruby programs. echo $echo; ?> |
And now you can run ruby with this php program.
Use the browser to open
yourdomain/yourphpfilename.php?d=yourbname.rb
And the ruby program will run and prints results.
And if you use Lighttpd webserv insert rewrite rule:
url.rewrite = ( "^/(.+.rb)$" => "/yourphpfilename.php?d=$1", )
If you already have some rewrite rules insert another rewrite rule
"^/(.+.rb)$" => "/yourphpfilename.php?d=$1",
Other webserv will be kind of the same.
An’ now. You can run your ruby programs through visit:
yourdomain/yourrubyfilename.rb


