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

Anybody familiar with this?

On Tue, Dec 1, 2009 at 5:35 PM, Romain Francois
<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]]


