Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

unable to run r scripts using rapache?

142 views
Skip to first unread message

suresh kumar Gorakala

unread,
Sep 17, 2014, 5:35:48 AM9/17/14
to rap...@googlegroups.com

I have installed Rapache using the below code on ec2:

apt-get install r-base-dev apache2-mpm-prefork apache2-prefork-dev
wget http://www.rapache.net/rapache-1.2.3.tar.gz 
tar xzvf rapache-1.2.3.tar.gz
cd rapache-1.2.3
./configure 
make
make install   

Then at /var/www/html folder I have added a r script called test.R file with below code:

<%
print(rnorm(100))
%>

Made changes to .conf file at /etc/apache2/sites-available as below:

<VirtualHost *:80>       


LoadModule R_module /usr/lib/apache2/modules/mod_R.so
    ServerName 5*.2**.***.**
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    ROutputErrors

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

    <Location /var/www/html>
    SetHandler r-script
    RHandler sys.source
    </Location>    

</VirtualHost>

when I run the browser http://localhost/test.R

I'm just getting print(rnorm(100)) instead of proper results like:

[1] -0.42690476 -0.08042903 -1.12774910  1.09807142  0.05778597  1.76122503  0.46055559  0.81081209 -2.30502371
[10]  0.91361172

Is there something which I'm missing?

Message has been deleted

suresh kumar Gorakala

unread,
Sep 18, 2014, 9:50:37 PM9/18/14
to rap...@googlegroups.com
The issue is fixed by following steps: 
1) installed brew R package. 
2)changed "Location" to "Directory" 
3) changed "SetHandler r-handler" to "SetHandler r-script" 
4) changed the "RFileHandler" line to "RHandler brew::brew" 
5) restarted Apache 
Reply all
Reply to author
Forward
0 new messages