I'm attempting to run embedded ruby inside rhtml.

$cat test.rhtml

<html>
<body>
Testing <% foo = "Ruby"; print "#{foo}!" %>
</body>
</html>

It really works fine in the command line:

$eruby test.rhtml


<html>
<body>
Testing Ruby!
</body>
</html>

But within my apache setup it does not work.

Being able to access "http://localhost/cgi-bin/test.rhtml" gives following error:

"Internal Server Error

The server experienced an interior error or misconfiguration and was not able to accomplish your request.

Please contact the server administrator, you@example.com and tell them of times the mistake happened, and anything you may have done that could have triggered the mistake.

More details relating to this error might be obtainable in the server error log."

Error log states:

[Sitting Jan 22 17:56:07 2011] [error] [client ::1] (8)Professional format error: professional of 'Dir/cgi-bin/test.rhtml' unsuccessful [Sitting Jan 22 17:56:07 2011] [error] [client ::1] Premature finish of script headers: test.rhtml

I've replicated "eruby" executable to "Dir/cgi-bin/" directory and set up apache (2.2) the following:

AddType application/x-httpd-eruby .rhtml
Action application/x-httpd-eruby Dir/cgi-bin/eruby

Any ideas? Thanks!

You most likely have to add, at least,

Content-type: text/html

<html>
....

towards the top of your eruby file -- CGI scripts have the effect of delivering back headers towards the client prior to the content. There might be more headers which make sense to transmit back, but this can be sufficient to obtain began.