无法使用R以酿造 [英] Unable to brew using R
问题描述
httpd.conf文件的配置是这样的:
httpd.conf file config for brew is this:
<Directory /usr/local/apache2/htdocs/brew>
SetHandler r-script
RHandler brew::brew
DefaultType text/html
</Directory>
冲泡文件夹下,我有这个文件:
under the brew folder, I have this file:
<html>
<body>
<%
library(Cairo)
filename <- paste(tempfile(tmpdir='/usr/local/apache2/htdocs'), '.png', sep='')
CairoPNG(filename)
x<-1:10000
plot(x, type="l", col="red")
dev.off()
%>
<img src="<%=filename%>"/>
</body>
</html>
我设置的所有权限777为安全起见,至少直到我得到它的工作。
I set all the permission 777 to be on the safe side, at least until I get it working.
当我打电话 HTTP://localhost/brew/temp.brew ,我看到该文件正在生成htdocs文件夹下,但浏览器不显示图像,得到一个破碎的形象。我在想什么?再次感谢该组所有帮助。
When I call http://localhost/brew/temp.brew, I see the file is being generate under htdocs folder but the browser is not displaying the image, get a broken image. What am I missing? Thanks again for all the help from this group.
当我尝试酿造一些简单的像这样,我得到的打印输出上的浏览器:
When I try to brew something simple like this, I get the print out on the browser:
<%
x<-1:1000
print(x)
%>
这可能是相关的一个Apache。当我这样做:
This may be an apache related. When I do this:
<%=filename%>
我得到这个浏览器:
I get this on the browser:
/usr/local/apache2/htdocs/file199c5ea9644c.png
我的apache的主目录是USR /本地/的Apache2 / htdocs目录,但在提供/完整路径
IMG SRC =&LT;%=文件名%>
它认为这是/usr/local/apache2/htdocs/filename.png,阿帕奇不知道这是什么。任何想法?
My apache home directory is /usr/local/apache2/htdocs, but when the full path is provided in img src="<%=filename%>" it sees it as /usr/local/apache2/htdocs/filename.png, apache dont know what this is. Any ideas?
推荐答案
本地文件名,以其全面,只知道到服务器(Apache):
客户端(网页浏览器),你需要一个URL或相对路径。
尤其是,的/ usr /本地/的Apache2 / htdocs目录
preFIX应该不再存在。
The local file name, with its full, is only known to the server (apache):
for the client (your web browser), you need a URL or a relative path.
In particular, the /usr/local/apache2/htdocs
prefix should no longer be there.
尝试更换
<img src="<%=filename%>"/>
与
<img src="<%=gsub('/usr/local/apache2/htdocs', '', filename)%>"/>
这篇关于无法使用R以酿造的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!