繁体   English   中英

在Windows XAMPP中安装R和RApache

[英]Installing R and RApache in XAMPP for Windows

如何在Windows的XAMPP中安装R和RApache?

我是XAMPP,Unix和服务器环境的新手。 我已经四处搜寻,但找不到将PHP,XAMPP,Windows和R组合在一起的方法。

我正在尝试编写一个通过PHP exec()函数将变量传递给R的网页。 最终用户希望在参数上使用ggvis图,因此R是必需的。

我在Windows 8.1上运行XAMPP。 基本安装工作正常,但是我被困于通过exec()传递变量,因为尽管我的Windows环境中有R,但我的XAMPP环境中没有安装RRApache

我已经尝试了rApache安装说明

在shell上运行'sudo apt-get install devscripts git'返回错误

无法将“ sudo”识别为内部或外部命令,可操作程序或批处理文件。”

错误sudo is not recognized as an internal or external command, operable program or batch file is because, you are trying to run Linux command on window shell ( command prompt) 我认为不可能在XAMPP上集成R,Apache,MySQL,PHP。 我很想知道如果有人有新的解决方案,我会学到更多。 但是,正如您在评论中提到的那样,使用exec只需R脚本的路径。 这是一个有效的R脚本

php / html脚本

<?php
error_reporting(E_ALL & ~E_NOTICE);
if(isset($_GET['N']))   {
  $N = $_GET['N'];    
exec("\"C:\\Program Files\\R\\R-3.2.3\\bin\\Rscript.exe\"
      C:\\my_folder\\www\\R-scripts\\Test.R $N", $output);
echo '<pre>', join("\r\n", $output), "</pre>\r\n";
  $nocache = rand();
  echo("<img src='temp.png?$nocache' />");
}

$out .= "
<form method='get'>
   Number values to generate: <input type='text' name='N' />
   <input type='submit' />
</form>";
echo $out;

R脚本

args <- commandArgs(TRUE)
N <- args[1]
x <- rnorm(N,0,1)
print(x)
png(filename = "temp.png", width=500, height=500)
hist(x, col = "lightblue")

但是,我很想知道是否有R的更新包或php的模块来集成R和PHP。 有什么专家可以更新这个话题吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM