[R] running R from PHP

Joe Conway mail at joeconway.com
Wed Feb 4 20:21:02 CET 2004

brook at biology.nmsu.edu wrote:
> Both run from terminals and png.R will run without a normal X server 
> if Xvfb is running.

> Neither runs under PHP, though (when invoked as "R --no-save < 
> xxx.R").

> They yield the following errors (with the R startup banner deleted 
> for compactness):

> could not open PNG file `g.png'

> cannot open `pdf' file argument
> `/usr/pkg/share/httpd/htdocs/test-R/g.pdf'

 From the evidence above, I'd guess a file permission error. The web 
server probably runs as the user "apache" or something similar -- does 
that user have write permission to the place where you are trying to 
create the images?

Try writing to "/tmp/g.png" and "/tmp/g.pdf" and see if the files get 



More information about the R-help mailing list