Rhtml (eruby) apache problem

I am trying to run inline ruby ​​inside rhtml.

$cat test.rhtml

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

It works fine from the command line:

$eruby test.rhtml


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

But inside my apache installation this does not work.

Access to "http: //localhost/cgi-bin/test.rhtml" gives the following error:

"Internal Server Error

The server detected an internal error or incorrect configuration and was unable to fulfill your request.

Contact the server administrator you@example.com and tell them about the time the error occurred and what you could do to cause the error.

Additional information about this error may be available in the server error log. "

The error log says:

[Sat Jan 22 17:56:07 2011] [error] [client:: 1] (8) Exec: exec 'Dir/cgi-bin/test.rhtml' [Sat Jan 22 17:56:07 2011] [error] [client:: 1] script : test.rhtml

"eruby" "Dir/cgi-bin/" apache (2.2) :

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

? !

+3
2

, , , ,

Content-type: text/html

<html>
....

eruby - CGI . , , .

+1

Apache/2.2.22 Ubuntu 12.04 Ruby 1.8.7. erubis 2.7.0 erubis Apaches cgi, /usr/lib/cgi -bin/erubis. cgi script erubis.sh .rhtml, /etc/apache/httpd.conf:

AddType application/x-httpd-eruby .rhtml
Application application/x-httpd-eruby /cgi-bin/erubis.sh

, Action , :

$ sudo a2enmod action

bash script erubis.sh :

#!/bin/bash
echo "Content-type: text/html"
echo
echo "<!DOCTYPE HTML>"
erubis -E Stdout <$DOCUMENT_ROOT$REQUEST_URI

http-, erubis .rhtml, Ruby. Ruby Stdout.

http://techdog.tumblr.com/post/36496065877/configure-erubis-cgi-in-apache

0

Source: https://habr.com/ru/post/1787237/


All Articles