0
我正在终端中运行包含Rscript的php脚本。它的工作正常,并提供输出。但如果我从网页调用它不提供任何输出相同的脚本。我也检查了文件夹权限。请帮我解决这个问题。在php脚本中的R脚本
我的PHP脚本:
<?php
$abc=exec('Rscript dist/GS_R2html.R');
print "$abc\n";
?>
RSCRIPT:
a<-rnorm(1000)
library(R2HTML)
setwd('/var/www/test')
HTML.title("Data Summary", file="dist/gshtml.htm",append=F)
HTML(summary(a),file="dist/gshtml.htm",align="left")
HTML(matrix(a[1:100],nrow=10,byrow=T),file="dist/gshtml.htm",align="left")
HTML.title("Histogram", file="dist/gshtml.htm")
jpeg("dist/plot2.jpg")
hist(a,col="red")
HTMLInsertGraph("dist/plot2.jpg",file="dist/gshtml.htm",Align="left")
dev.off()
在您的电话中尝试Rscript的完整路径 – 2013-05-10 07:06:57
我试图给出完整路径 – Dadu 2013-05-10 08:34:52
您是否尝试过在您托管网页的同一台计算机的终端中使用php脚本?您是否尝试过调用更简化的R脚本,以查看php - > R连接是否有效? – 2013-05-10 11:37:28