From simon.urbanek at r-project.org  Thu Oct  6 03:54:18 2011
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Wed, 5 Oct 2011 21:54:18 -0400
Subject: [Rd] Question about Rweb
In-Reply-To: <46a401cc83ab$1a27bd40$4e7737c0$@gmail.com>
References: <096E99C76E4DCC469728CD4104D7C9B602A8F0@MBX10A.davidson.edu>
	<1567A640-1E4F-4E7E-8FC6-74FFEAA247DA@r-project.org>
	<45ca01cc8399$6ae06eb0$40a14c10$@gmail.com>
	<35A53345-D6DA-4656-8479-CDBF057CB390@r-project.org>
	<46a401cc83ab$1a27bd40$4e7737c0$@gmail.com>
Message-ID: <056DB147-35AA-4FC5-AB10-DBF16C4100F9@r-project.org>

Ted,

On Oct 5, 2011, at 6:06 PM, Ted Byers wrote:

> Hi Simon,
> 
>> -----Original Message-----
>> From: Simon Urbanek [mailto:simon.urbanek at r-project.org]
>> Sent: October-05-11 5:07 PM
>> To: Ted Byers
>> Cc: 'Tonidandel, Scott'; r-devel at r-project.org
>> Subject: Re: [Rd] Question about Rweb
>> 
>> Ted,
>> 
>> On Oct 5, 2011, at 4:00 PM, Ted Byers wrote:
>> 
>>> Hi Simon,
>>> 
>>> Any chance of getting step by instructions on setting it up to work
>>> with a web server like Apache's httpd server (I have Apache's web
>>> server running, actually a couple instances on different ports, and I
>>> do all my CGI programming using Perl)?
>>> 
>> 
>> The setup is really easy (it supports either CGI or PHP), but you're on
> the
>> wrong platform :P see below.
>> 
> Actually, I haven't had much choice with regard to platform.  I presently
> work in a Windows only shop.
> 
>> [snip]
>>> On http://rforge.net/FastRWeb/files/, I read that FastRWeb is to be
>>> installed using
>>> "install.packages('FastRWeb',,'http://www.rforge.net/')",
>>> but that gives me the following message:
>>> 
>>>> install.packages('FastRWeb',,'http://www.rforge.net/')
>>> Installing package(s) into 'C:\Users\Ted\Documents/R/win-library/2.12'
>>> (as 'lib' is unspecified)
>>> Warning message:
>>> In getDependencies(pkgs, dependencies, available, lib) :
>>> package 'FastRWeb' is not available
>>>> 
>>> 
>>> This was on:
>>> 
>>> R version 2.12.0 (2010-10-15)
>>> Copyright (C) 2010 The R Foundation for Statistical Computing ISBN
>>> 3-900051-07-0
>>> Platform: x86_64-pc-mingw32/x64 (64-bit)
>>> 
>> 
>> Well, technically, you can run it on Windows, but I would not recommend
> it.
>> Windows is a really bad server platform, especially with R (no fork, no
> parallel
>> connections, no unix sockets ...).
>> 
> Yes, I know it's limitations, but at present I have no option but to deal
> with it.
> 
>> The standard configuration in FastRWeb assumes a unix server (the more
>> common case) and it really consists of install.packages() and then copying
>> Rcgi from the cgi-bin directory of the installed FastRWeb package to your
>> web server's cgi-bin and starting Rserve (via /var/FastRWeb/code/start).
>> Alternatively, you can use the PHP client from Rserve instead of CGI.
>> 
>> If you really want to use Windows, I have fixed the Windows build so it
>> should work, but you'll have to configure it by hand -- but as I said, I
> strongly
>> discourage the use of Windows for any R-related server activities - there
> are
>> too many security implications and it's far less efficient.
>> 
> ;-)
> 
> I have the machine that will be doing the real work behind several layers of
> security.
> 
> How do I modify the command
> ""install.packages('FastRWeb',,'http://www.rforge.net/')"," so that it uses
> RTools to build it for Windows?
> 

Just re-run it, I have fixed the Windows build so I think the binary should be there. I had to run after I sent the e-mail so I didn't get to check one point, though: the Rcgi.exe binary may be either 32-bit or 64-bit which in the latter case may be a problem on 32-bit machine, but I see you have 64-bit Windows so you should be fine in either case.

However, you'll need to setup the FastRWeb tree. I did not change the defaults so it still expects things to live in /var/FastRWeb by default, so if you have Rtools, you may succeed in running the install.sh script (in the installed FastRWeb package -- see system.file("install.sh",package="FastRWeb"))  that was designed from unix even on Windows. The only difference is that you will want to remove the "socket ..." line from rserve.conf since Windows doesn't support it. If you don't have Rtools, you can simply start Rserve by hand - and then read Rserve docs about the options you have for pre-loading of packages and code. I didn't actually test the Windows setup with a web server so feedback is welcome.


> PS: I may have a machine soon to set up with Linux (the OS on that machine
> crashed, got corrupted, so I'll have to wipe its disk and install de novo.
> Is there a preferred distribution of Linux you can recommend (one for which
> I can download DVD disk images so I can burn install DVDs on one of my
> Windows boxes, or are they all pretty much the same?
> 

Ubuntu is currently the most popular and works out of the box on most machines. Personally, I prefer Debian on servers, but there is not a big difference.

Cheers,
Simon



[Rd] Question about Rweb
Simon Urbanek