From: Matthew R Chase Date: 2012-05-25T11:43:00+09:00 Subject: Re: autorun .rb like a .php I would terminate your ruby file with .cgi instead of .rb. Then to get ruby to "run like php" you just ensure the file is executable and "AddHandler cgi-script .cgi" to your apache config. I'm sure you realize ruby is little like PHP in this regard. PHP embeds itself in an HTML file. Ruby executes on the server, and whatever it puts will be sent to the client as ... whatever you declare your content-type to be. So before you start putting HTML, you need to: puts "Content-type: text/html\n" before putting plain text, it'd be: puts "Content-type: text/plain\n" and json: puts "Content-type: application/json\n" -- Posted via http://www.ruby-forum.com/.