Hi I have seen a few posts to this list regarding problems accessing the x11() device over cgi - namely, when trying to create a graphic using the jpeg() function, everything is fine from the command line but it won't work over cgi, producing the error: "Unable to open connection to X11 display" Has anyone actually solved this particular problem satisfactorily? Please reply direct to me as I am not a member of the list (yet!) Thanks in advance for your help Michael Watson Head of Informatics Institute for Animal Health, Compton Laboratory, Compton, Newbury, Berkshire RG20 7NN UK Phone : +44 (0)1635 578411 ext. 2535 Mobile: +44 (0)7764 490236 E-mail: michael.watson at bbsrc.ac.uk
Yes, it has been solved and discussed in the R-help archives many times. The help(jpeg) page is pretty explicit too. One alternative is bitmap(). To use jpeg() under a Unix-alike you need to set up an X server that your R process can use. It's a bit hard to help you do that when you don't even mention your OS (I am inferring it is a Unix-alike), but you may be able to solve the permissions problem or you may be able to set by a server by something like Xvfb. In any case, it is not an R problem On Fri, 13 Jun 2003, michael watson (IAH-C) wrote:> I have seen a few posts to this list regarding problems accessing the > x11() device over cgi - namely, when trying to create a graphic usingNo, not the x11() device, but the jpeg() device. They are not the same!> the jpeg() function, everything is fine from the command line but it > won't work over cgi, producing the error: > > "Unable to open connection to X11 display" > > Has anyone actually solved this particular problem satisfactorily? > > Please reply direct to me as I am not a member of the list (yet!)-- 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
As Prof.Ripley has kindly pointed out, bitmap and Xvbf are possible solutions. See also replies from vfasciani on Tuesday, March 18, 2003 5:32 PM Wednesday, March 19, 2003 6:36 PM You might also want to check out the e-mail from Steve Chen regarding R and PHP on Friday, June 13, 2003 2:36 AM Regards, Adai. -----Original Message----- From: michael watson (IAH-C) [mailto:michael.watson at bbsrc.ac.uk] Sent: Friday, June 13, 2003 10:22 PM To: 'r-help at stat.math.ethz.ch' Subject: [R] Using jpeg() function over cgi Hi I have seen a few posts to this list regarding problems accessing the x11() device over cgi - namely, when trying to create a graphic using the jpeg() function, everything is fine from the command line but it won't work over cgi, producing the error: "Unable to open connection to X11 display" Has anyone actually solved this particular problem satisfactorily? Please reply direct to me as I am not a member of the list (yet!) Thanks in advance for your help Michael Watson Head of Informatics Institute for Animal Health, Compton Laboratory, Compton, Newbury, Berkshire RG20 7NN UK Phone : +44 (0)1635 578411 ext. 2535 Mobile: +44 (0)7764 490236 E-mail: michael.watson at bbsrc.ac.uk ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
OK, thanks for all your help :-D Sorry for not observing normal e-mail help list rules - I am running SUSE 8.1 professional. If someone coule try and explain a little as to why jpeg() can be used when I run the script as the user httpd runs as, and why it can't when it is run from a cgi script by the same user, then I may be able to get a handle on the problem. I have tried using bitmap() instead but quite frankly the images produced are just not of the same quality, either using type="jpeg" or type="png256" and messing around with resolution - they just look more grainy and the circles are, well, more square. So i guess my REAL question is how do i get images on the same quality over cgi if I am not using the jpeg() function? And in theory it is an R question, as my linux sys/admin doesn't have a clue why we're getting X11 error message over cgi because he hasn't got a clue how the jpeg() R function works. The documentation states: "they may not be usable unless the X11 display is available to the owner of the R process" Well i run httpd as a user called "base" and if i log in to a shell as base, trust me the X11 display IS available then. Sooooo, if someone could explain WHY jpeg() won't work over cgi, then i can explain to my sys/admin and he can fix it for me. OR alternatively, if someone can explain to me how to coax bitmap() into producing images of the quality of jpeg()...?? Thanks Mick -----Original Message----- From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] Sent: 13 June 2003 16:02 To: michael watson (IAH-C) Cc: 'r-help at stat.math.ethz.ch' Subject: Re: [R] Using jpeg() function over cgi Yes, it has been solved and discussed in the R-help archives many times. The help(jpeg) page is pretty explicit too. One alternative is bitmap(). To use jpeg() under a Unix-alike you need to set up an X server that your R process can use. It's a bit hard to help you do that when you don't even mention your OS (I am inferring it is a Unix-alike), but you may be able to solve the permissions problem or you may be able to set by a server by something like Xvfb. In any case, it is not an R problem On Fri, 13 Jun 2003, michael watson (IAH-C) wrote:> I have seen a few posts to this list regarding problems accessing the > x11() device over cgi - namely, when trying to create a graphic usingNo, not the x11() device, but the jpeg() device. They are not the same!> the jpeg() function, everything is fine from the command line but it > won't work over cgi, producing the error: > > "Unable to open connection to X11 display" > > Has anyone actually solved this particular problem satisfactorily? > > Please reply direct to me as I am not a member of the list (yet!)-- 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
Again, thank you one and all for your help! My web-server is apache, and simply adding the following line to httpd.conf solved my issues: SetEnv DISPLAY :0.0 :-D Mick -----Original Message----- From: michael watson (IAH-C) Sent: 16 June 2003 14:52 To: 'r-help at stat.math.ethz.ch' Subject: RE: [R] Using jpeg() function over cgi OK, thanks for all your help :-D Sorry for not observing normal e-mail help list rules - I am running SUSE 8.1 professional. If someone coule try and explain a little as to why jpeg() can be used when I run the script as the user httpd runs as, and why it can't when it is run from a cgi script by the same user, then I may be able to get a handle on the problem. I have tried using bitmap() instead but quite frankly the images produced are just not of the same quality, either using type="jpeg" or type="png256" and messing around with resolution - they just look more grainy and the circles are, well, more square. So i guess my REAL question is how do i get images on the same quality over cgi if I am not using the jpeg() function? And in theory it is an R question, as my linux sys/admin doesn't have a clue why we're getting X11 error message over cgi because he hasn't got a clue how the jpeg() R function works. The documentation states: "they may not be usable unless the X11 display is available to the owner of the R process" Well i run httpd as a user called "base" and if i log in to a shell as base, trust me the X11 display IS available then. Sooooo, if someone could explain WHY jpeg() won't work over cgi, then i can explain to my sys/admin and he can fix it for me. OR alternatively, if someone can explain to me how to coax bitmap() into producing images of the quality of jpeg()...?? Thanks Mick -----Original Message----- From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] Sent: 13 June 2003 16:02 To: michael watson (IAH-C) Cc: 'r-help at stat.math.ethz.ch' Subject: Re: [R] Using jpeg() function over cgi Yes, it has been solved and discussed in the R-help archives many times. The help(jpeg) page is pretty explicit too. One alternative is bitmap(). To use jpeg() under a Unix-alike you need to set up an X server that your R process can use. It's a bit hard to help you do that when you don't even mention your OS (I am inferring it is a Unix-alike), but you may be able to solve the permissions problem or you may be able to set by a server by something like Xvfb. In any case, it is not an R problem On Fri, 13 Jun 2003, michael watson (IAH-C) wrote:> I have seen a few posts to this list regarding problems accessing the > x11() device over cgi - namely, when trying to create a graphic usingNo, not the x11() device, but the jpeg() device. They are not the same!> the jpeg() function, everything is fine from the command line but it > won't work over cgi, producing the error: > > "Unable to open connection to X11 display" > > Has anyone actually solved this particular problem satisfactorily? > > Please reply direct to me as I am not a member of the list (yet!)-- 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