<[EMAIL PROTECTED]> writes: > Below are 2 scripts (png.R and pdf.R) I am trying to run in R from > PHP. > > # png.R > x11(display=":5") > png(filename="g.png") > plot(1:5) > graphics.off() > > # pdf.R > pdf(file="g.pdf") > plot(1:5) > graphics.off() > > 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): > > > x11(display=":5") > > png(filename="g.png") > Error in X11(paste("png::", filename, sep = ""), width, height, pointsize, : > unable to start device PNG > In addition: Warning message: > could not open PNG file `g.png' > Execution halted > > and > > > pdf(file="/usr/pkg/share/httpd/htdocs/test-R/g.pdf") > Error in PDF(file, old$family, old$encoding, old$bg, old$fg, width, height, : > unable to start device pdf > In addition: Warning message: > cannot open `pdf' file argument `/usr/pkg/share/httpd/htdocs/test-R/g.pdf' > Execution halted > > For reference, the R banner information includes the following: > > R : Copyright 2003, The R Development Core Team > Version 1.6.2 (2003-01-10) > > Any help on how to get these scripts to work is greatly appreciated.
Your R version is about a year out of date, but that's hardly the issue. I don't do PHP, but the error message in both cases has to do with file opening, so how about checking permissions on your current directory: Try sticking this into your script system("id; pwd; ls -la") Also notice that web applications often take special security measures and may change one or all of the following: working directory, root directory, user id, and group id. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html