From: Justin Collins Date: 2011-01-27T07:06:13+09:00 Subject: Re: rhtml and apache trouble On 01/26/2011 01:40 PM, Mitul Ti wrote: > I am trying to run embedded ruby inside rhtml. > > $cat test.rhtml > > <% print "Content-type: text/html\n\n" %> > > > > > > Testing<% foo = "Ruby"; print "#{foo}!" %> > > > > > > > It works fine from the command line: > > $eruby test.rhtml > > > Content-type: text/html > > > > > Testing Ruby! > > > > > > But inside my apache setup it doesn't work. > > Accessing "http://localhost/cgi-bin/test.rhtml" gives following error: > > "Internal Server Error > > The server encountered an internal error or misconfiguration and was > unable to complete your request. > > Please contact the server administrator, you@example.com and inform them > of the time the error occurred, and anything you might have done that > may have caused the error. > > More information about this error may be available in the server error > log." > > Error log says: > > [Wed Jan 26 13:21:53 2011] [error] [client ::1] (8)Exec format error: > exec of 'Dir/cgi-bin/test.rhtml' failed > [Wed Jan 26 13:21:53 2011] [error] [client ::1] Premature end of script > headers: test.rhtml > > > I have copied "eruby" executable to "Dir/cgi-bin/" directory and > configured apache (2.2) as follows: > > AddType application/x-httpd-eruby .rhtml > Action application/x-httpd-eruby Dir/cgi-bin/eruby > > Any ideas? Thanks! > > Your .rhtml files shouldn't be in cgi-bin/, they should be in public_html/ or similar. Looks like Apache's trying to execute the .rhtml file, which isn't an executable. -Justin