我进行了搜索,但找不到答案。如果有人能看一眼并分享我做错了什么,我真的很感激:
这是我的httpd.conf
文件中的内容:
<Directory /usr/local/apache2/htdocs/R>
SetHandler r-script
RHandler sys.source
</Directory>
这就是test.R
的内容,很简单:
<%
x<-1:10000
t=plot(x)
print(t)
%>
当我输入URL http://localhost/R/test.R
时,我得到一个内部服务器错误。Apache日志显示:
Traceback: 2: parse(n = -1, file = file) 1: sys.source(file = "/usr/local/apache2/htdocs/R/test.R", envir = .rAenv)
有什么想法吗?
正如在线Raache手册第3.6.6节中所说,"/var/www/R-files[/usr/local/apache2/htdocs/R下的任何文件都通过函数sys.source传递。"
<%
和%>
不是有效的R码,因此sys.source
呕吐。