We have a setup in which we use PHP (with Geeklog as a CMS) as a front end to MySQL. We plan to use R for offering user driven and automated statistical analysis of some of the data we obtain. We'll be using the R interface to the MySQL database from omegahat (www.omegahat.org) for getting the data out of the database, but we were wondering if somebody tackled the problem of how to integrate R nicely with PHP. Specifically, we know how to get R to run as a system command from PHP, but ideally we'd like to call R as a PHP function. If somebody did this we'd like to have some pointers as to how they did it If not, we'll probably do it ourselves and post the results Regards Roelof Versteeg versrj@inel.gov Idaho National Engineering and Environmental Laboratory [[alternative HTML version deleted]]
Hi VERSRJ at inel.gov wrote:> We have a setup in which we use PHP (with Geeklog as a CMS) as a front end > to MySQL. We plan to use R for offering user driven and automated > statistical analysis of some of the data we obtain. We'll be using the R > interface > to the MySQL database from omegahat (www.omegahat.org) for getting > the data out of the database, but we were wondering if somebody tackled > the problem of how to integrate R nicely with PHP. > > Specifically, we know how to get R to run as a system command from PHP, > but > ideally we'd like to call R as a PHP function. If somebody did this we'd > like > to have some pointers as to how they did it If not, we'll probably do it > ourselves > and post the resultsYou might want to take a look at R-php (http://dssm.unipa.it/R-php/) and R_PHP_Online (http://steve-chen.net/R_PHP/). Paul -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 paul at stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/
VERSRJ at inel.gov wrote:> We have a setup in which we use PHP (with Geeklog as a CMS) as a > front end to MySQL. We plan to use R for offering user driven and > automated statistical analysis of some of the data we obtain. We'll > be using the R interface to the MySQL database from omegahat > (www.omegahat.org) for getting the data out of the database, but we > were wondering if somebody tackled the problem of how to integrate R > nicely with PHP.If you can use Postgres instead of MySQL, see: http://www.joeconway.com/oscon-pres-2003-1.pdf Page 23 has an example PHP code snippet. Very simple because most of the work is done in the PL/R function. Joe