xorg, Xvfb, ImageMagick
Hi guys, i've been stuck on this for a while now, and will not repost my findings at http://forums.fedoraforum.org/showthread.php?p=1299875 in this forum, as i am past most of it now.
Here's where i'm still stuck: if i use any combination of this command from the cli, it is fine, but when executing it from apache, it doesn't work. I don't even get any errors for it any more (i got past most of that), but it just isn't working when executed with php/apache... The problem is that i can't find a way to execute ALL commands in the SAME Xvfb instance. It tries to open a new instance for each separate command passed to it. And this is the GOOD side; that is when i'm running it from the cli (local or live, doesn't matter); i can get it to work, for crap, from apache............ Code:
#!/bin/bash Thanx |
It isn't entirely clear to me from your posting in either forum exactly what your objective is. It looks like you simply want to use Xvfb as your X server on a headless machine. I do this all the time, by simply launching a perpetual Xvfb, as server 1, and then set $DISPLAY=localhost:1 for all subsequent X clients that need to use the virtual X server. I don't have any xvfb-run on any system I presently have access to; I simply have in rc.local
Code:
su -c "Xvfb :1 -auth /etc/Xvfb.auth -f /tmp" xvfbuser & I only ever use xterms on my virtual X servers, so I'm not sure what problems might crop up for other applications. When using Mozilla web browsers, it might be important to launch them with the -no-remote option, so they don't try to latch on to a pre-existing instance with the [annoying] x-remote feature. --- rod. |
Well, you're close.
I'm launching it with apache, by hitting a php test page on ionisis.com, and that php page calls the exec command which is supposed to launch a virtual x (Xvfb), and then a firefox instance, and sleeps for 4 seconds, and then uses import to grab a screenshot of the website. I've got this all in a shell script, and if i exec the shell script from the console, as a USER (me, or root), on my machine OR my server, all is fine; but when i have APACHE exec it via php "exec", i keep running into various problems. I've got ALMOST all of it sorted out right now :D. I had to create a /var/www/.gnome/ and a /var/www/.gnome_private/ and a /var/www/.gnome/accels directory that eliminated a LOT of errors, and now i actually get a screenshot from it when using apache! However it is an EMPTY X screen, with the old-school cross hatch background, and no firefox or import. Like i said, i've tracked down a lot of the errors, and eliminated them. Here are the latest errors (in total): Code:
[^v^] cat /var/log/httpd/error_log | tail Thanx! |
Okay, now I get it. Is there any reason not to launch the virtual X server once only, and leave it running? You can have the first invocation start it up, and then simply test for existence of it on subsequent invocations. Also, from my experience, if the virtual X server uses a font server, especially a remote font server, it takes a finite time to initialize the fonts. I put a 3 second sleep between starting Xvfb and running any X client that would use it. Perhaps Apache + PHP is slower to load Xvfb, and you require more than 4 seconds to complete. Have you tried launching something smaller/faster than Firefox, at least as a test?
I'm not extremely familiar with Apache configuration, but as I recall, there are several config items that limit Apache's use of the filesystem. Also, there is the favorite old water hazard called Selinux, which always seems to be particularly entertaining in how it interacts with Apache. The error messages you posted make me think that Xvfb is inheriting some of these restrictions, as a child process of Apache. --- rod. |
Well, believe it or not, i'm actually very good about configuring servers to work WITH SELinux (see Linux Intro articles on Samba, FTP, and Webservers), and i'm not getting any SEL context error or Permission Denied errors (i was getting pm denied before, but i fixed it). Also, apache IS creating the thumbnail, but again, it is only an exmpty x background; so it IS writing to the fs just fine, afaik.
I am open to keeping Xvfb running, but not firefox. I have to pay for memory on my dedicated servers, and so if something takes to much memory, guess which process is the first to fail: named!!!!!! So i try to be very cautious about memory. As far as *lighter* browsers, i'm open to suggestions as well, ESPECIALLY if they DO NOT have that damned session restore feature :D! I am not using "sleep 4" until AFTER i launch firefox, which works fine in user mode, but not apache mode. I do not use it at all between the launch of Xvfb and firefox; i will try it and see if it helps. So, with a persistent Xvfb instance, do you think that perhaps i could launch it as a USER, and then USE it from APACHE? Thanx |
Quote:
Also, the business of Code:
Xlib: extension "RANDR" missing on display ":66.0". Quote:
Quote:
I am curious how you look after all of the processes that seem to be getting launched. That is part of my rationale behind reducing the chain of processes. Quote:
Sounds like a fun project you've got cooking, there. --- rod. |
Hmm, i don't know why i'm not getting my reply notifications, it is set for instant notification...
Quote:
Quote:
Quote:
Quote:
|
Quote:
Code:
#!/bin/sh I use scrot Code:
scrot -c -d 3 importscreenshot.jpg |
Ok, but you're running that as a USER, or as APACHE?
Thanks |
All times are GMT -5. The time now is 06:58 AM. |