简体   繁体   中英

rApache module in Apache error

I'm using ubuntu 13.10 with Apache2 , PHP5 and MySQL I'm trying to add rApache module in Apache to work as a server R.

I configured my rapache exactly how this turorial shows .

http://binfalse.de/2011/05/r-for-the-web/

One file is created /etc/apache2/mods-available/r.conf

In this file , and put

<Location /R>
  ROutputErrors
  SetHandler r-script
  RHandler sys.source
</Location>

<Location /RApacheInfo>
  SetHandler r-info
</Location>

I add another "location"

<Location /brew>
  SetHandler r-script
  RHandler brew::brew
</Location>

in /brew directory I created a file called plot.R with the code :

<%

args <- 'brew work'
print(args)

%>

localhost/brew/plot.R if I try to access the page is loading endlessly and program files /var/log/apache2/error.log displays the error :

 Error in library(brew) : there is no package called 'brew'
  From directive RHandler on line 3 of /etc/apache2/mods-enabled/r.conf.

I 've tried to install R in the brew package

 install.packages("brew","/usr/local/lib/R/library")

but my error keeps appearing and I can not run the script plot.R

You need to install package brew and restart Apache.

Mark that it is important to install the package at the library location of R which is used by RApache. To see which .libPaths are used by RApache, you can go to localhost/RApacheInfo in your browser (the following screenshot shows mine). If you installed RApache in the default way, the libpaths are probably not the path of your own user (eg in my case this is /home/janw/R/x86_64-pc-linux-gnu-library/3.0) but of the system wide library (probably /usr/lib/R/library). So make sure you install the package there: install.packages("brew", lib="/usr/lib/R/library") . Or log in as root and install the package.

su root
R
> install.packages("brew")

And don't forget to restart RApache!

sudo /etc/init.d/apache2 restart 

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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