Hi everyone, 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 4) ??? Does this seem right and/or possible? I'm not sure how PHP can "receive" the graphic generated by R. I have Apache/PHP/MySQL running. Any help or pointers would be appreciated. -John
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.exeNo. 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
You could query your dbase using the RMySql package and then publish your results using the RWeb package. Paolo On Sat, 1 Nov 2003 15:00:04 -0800, John Kim <johnbkim at fastmail.fm> wrote:> Hi everyone, > > 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 > 4) ??? > > Does this seem right and/or possible? I'm not sure how PHP can "receive" > the > graphic generated by R. I have Apache/PHP/MySQL running. Any help or > pointers would be appreciated. > > -John > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help >
John, I am sorry for the delayed reply...since it sounds like you would need to gain some knowledge on how to integrate components like Apache, MySQL, PHP, and R, I highly recommend one or more of Paul Dubois' books: 1) MySQL 2) MySQL Cookbook 3) MYSQL and Perl for the Web While the primary focus of these is the MySQL database, the author is very thorough in explaining how to connect MySQL to other tools like Apache and PHP. Even the third book, while certainly Perl-centric, illustrates concepts that are applicable to other glue languages such as PHP and Python. Even some of the OS differences between Windows and Linux are included in his discussions. There is overlap amongst all three, but enough distinction to make all 3 a worthwhile investment if indeed you wish to come with a reliable practical solution. If you want to invest in only one, I would start with the MySQL book. Hope this helps. Bill ---------------------------------------- Bill Pikounis, Ph.D. Biometrics Research Department Merck Research Laboratories PO Box 2000, MailDrop RY33-300 126 E. Lincoln Avenue Rahway, New Jersey 07065-0900 USA Phone: 732 594 3913 Fax: 732 594 1565