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>
I set all the permission 777 to be on the safe side, at least until I get it working.
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)
%>
This may be an apache related. When I do this:
<%=filename%>
I get this on the browser:
/usr/local/apache2/htdocs/file199c5ea9644c.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?
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.
Try replacing
<img src="<%=filename%>"/>
with
<img src="<%=gsub('/usr/local/apache2/htdocs', '', filename)%>"/>