[R] Calling R from PHP on Win2K?

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Nov 2 08:31:13 CET 2003


On Sat, 1 Nov 2003, John Kim wrote:

> I'd like to call R from a PHP script to draw graphs (using data selected
> from a MySQL database) on Windows 2000. I think what I need to do is:
> 
> 1) Install R for Windows
> 2) Install Perl
> 3) From PHP make a system call to Rcmd.exe

No.  Rcmd.exe is just a frontend to R's utilities; it does not run R.
I suggest you do 1) first and understand how R on Windows works.

> 4) ???
> 
> Does this seem right and/or possible? I'm not sure how PHP can "receive" the
> graphic generated by R. 

I am not sure what you mean: PHP is a scripting language, not a graphics 
windowing system.

> I have Apache/PHP/MySQL running. Any help or
> pointers would be appreciated.

The usual way to do this on Windows is via DCOM (see the rw-FAQ), but you 
could call the command-line executable Rterm.exe and either let it display 
files or create e.g. PNGs and subsequently put those on a web page.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list