RServe looks exciting but the problem is that I am not sure whether I would
be allowed to install anything on the linux server on which I am working.

On Wed, Dec 2, 2009 at 3:40 PM, Romain Francois
<romain.francois@dbmail.com>wrote:

> On 12/02/2009 10:43 AM, Amrit Nandan wrote:
>
>> I tried calling R from a shell script and it works. This is an example
>> file rscript.sh
>>
>> R --no-save << EOT
>> x<-2*pi
>> print(cbind(x,sin(x)))
>> quit("no")
>> EOT
>>
>> This works perfectly on the Linux machine in which I have logged in via
>> SSH using the command ("./rscript.sh")
>>
>> I tried running this command using php
>>
>> <html>
>> <?php
>>
>> $output = array();
>> $$retval = 0;
>> $a = shell_exec('./rscript.sh'." 2>&1");
>> //print phpinfo();
>> print $a;
>>
>> ?>
>> </html>
>>
>> this does not work and gives me this error:
>>
>> ./rscript.sh: line 1: R: command not found
>>
>
> Maybe shell_exec('sh ./rscript.sh 2>&1' ) instead, maybe you need to have
> the full path of R.
>
> With this design, you are going to start a new R session each time you want
> anything to be computed, and you are going to have to format the result of
> the R code as a string and parse this string back in php.
>
>
>
> You really should look into Rserve and its new php client, which I think
> will solve all of these problems at once.
>
> Just download the version 0.6-1 from here :
> http://www.rforge.net/Rserve/files/
>
> $ wget http://www.rforge.net/src/contrib/Rserve_0.6-1.tar.gz
> # R CMD INSTALL Rserve_0.6-1.tar.gz
>
> start the server
>
> $ R CMD Rserve
>
> grab the php client, and include it into your php application
>
> $ tar zxvf Rserve_0.6-1.tar.gz
> $ less Rserve/src/client/php/simple.php
>
> If you try this route, be aware that the php client is very new. also you
> probably want to post questions regarding it on this mailing list :
> http://mailman.rz.uni-augsburg.de/mailman/listinfo/stats-rosuda-devel
>
> Romain
>
>
>  Anybody familiar with this?
>>
>> On Tue, Dec 1, 2009 at 5:35 PM, Romain Francois
>> <romain.francois@dbmail.com <mailto:romain.francois@dbmail.com>> wrote:
>>
>>    On 12/01/2009 12:48 PM, Hrishi Mittal wrote:
>>
>>        Hi Amrit,
>>
>>        I believe you can you use the PHP system command to call Rscript
>>        or R CMD. I
>>        don't know much PHP but this page might be useful -
>>        http://php.net/manual/en/function.system.php.
>>
>>        You might also want to look at rapache -
>>        http://biostat.mc.vanderbilt.edu/rapache/
>>
>>        Good luck with your project and do post a link to your webpage
>>        when you get
>>        it running.
>>
>>
>>    There is also a simple php client to Rserve in the next version of
>>    Rserve. http://www.rforge.net/Rserve/index.html
>>
>
> --
> Romain Francois
> Professional R Enthusiast
> +33(0) 6 28 91 30 30
> http://romainfrancois.blog.free.fr
> |- http://tr.im/FtUu : new package : highlight
> |- http://tr.im/EAD5 : LondonR slides
> `- http://tr.im/BcPw : celebrating R commit #50000
>
>

	[[alternative HTML version deleted]]


