473,654 Members | 3,071 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Capturing a display on remote (linux) server from (windows) web browser

Hello there,

I've a utility that runs on a linux machine. Basically, it opens
a window, draws a figure and captures the image (screen) and stores
it as a jpeg file. The utility requires a window to be open
(or displayed) inorder to save the image. Also, this utility is
in the form of an executable, so I can't possibly alter it.

I want to run this utility from a windows web browser and display
the saved jpeg file. I pass some command line parameters to change
the figure it draws. The php code I use is as below:

<?php

putenv("VIEWER_ HOME=/path/to/viewer_home");

//putenv("DISPLAY servername:45") ;

$prgfile="viewe r -m save.mac";
exec($prgfile, $output, $rc);
foreach($output as $row) echo "<br>$row";
echo "<br>";
print_r($rc);

?>

I connect to the linux server from my windows desktop using RealVNC
and the php script works when I run it from the server shell
prompt (using "php <scriptname>" ). It opens a display, captures the
image and closes the display. But when I run the script from windows
web browser I get an error (in the apache "error_log" file).

"Error: Can't open display"

Is there a way I can make this work?

TIA,
Hemanth

P.S: I'm not sure if my question is entirely relevant to this group
but any pointers to the right group will be helpful.

Jul 17 '05 #1
3 2430
Hemanth <he************ *****@gmail.com > wrote:
I connect to the linux server from my windows desktop using RealVNC
and the php script works when I run it from the server shell
prompt (using "php <scriptname>" ). It opens a display, captures the
image and closes the display. But when I run the script from windows
web browser I get an error (in the apache "error_log" file).

"Error: Can't open display"

Is there a way I can make this work?
You can...
P.S: I'm not sure if my question is entirely relevant to this group
but any pointers to the right group will be helpful.


A linux group offcourse, related to X: comp.os.linux.x (or simply misc)
might be better. If you don;t understand below take it there :)

The difference is that when you run the script from commandline in vnc,
it's running as you and it has an readily available display to write to.

Apache is running under an other user and knows not of any display to
write to.

Solution:
Q&D: give apache access to your vnc session (which from then on will
need to be running always on a known port), with 'xhost localhost' and
set the DISPLAY variable in your script to that display:
putenv('DISPLAY =localhost:45') ;

This will give _ANY_ user on localhost access to your display, enabling
them to read every key you type and your entire screen.

Less Q&D: run an vnc session as the apache user, you can then leave out
the xhost part.

BTW what program are you running (just curious)?

Jul 17 '05 #2
Daniel,

Sorry for a late reply. Could you please elaborate on your first
solution.
Normally, I run a startup script to open a vnc session. I tried to do
the same from the web browser (trying to start a vnc session using
apache user on port 99). The startup script I used is as follows:

Xvnc -geometry 800x600 -depth 24 :99 &
sleep 4
setenv DISPLAY "$HOST":99
sleep 4
/usr/bin/startkde &

The script works when I run it using myuserid. But I get this error
message (in apache error_log) when run from webbrowser.

Fatal server error:
Cannot establish any listening sockets - Make sure an X server isn't
already running
sh: setenv: command not found
Cannot create temp file //KDE.startkde.3J rTHi
/usr/bin/startkde: $testfile_home: ambiguous redirect
_XSERVTransSock etUNIXCreateLis tener: ...SocketCreate Listener() failed
_XSERVTransMake AllCOTSServerLi steners: server already running
Could you pls throw some light on it.

- Hemanth

Jul 17 '05 #3
BTW, the viewer program I'm running is K2 Quickview.

- Hemanth

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2675
by: Dan V. | last post by:
Situation: I have to connect with my Windows 2000 server using VS.NET 2003 and C# and connect to a remote Linux server at another company's office and query their XML file. Their file may be updated every hour or so. How can I do this easily? I would like to use secure communication even encryption if possible. I would query and insert locally only the newest records found in that XML file to an xml or MS access db.
14
9024
by: jj | last post by:
Is it possible to call a remote php script from within Access? I'm thinking something like: DoCMD... http://www.domain.com/scripts/dataquery.php DoCmd.OpenQuery "update_data", acNormal, acEdit ..... So the PHP script does something on the server database, then when a linked table is viewed within access, the data changes have been made?
5
5677
by: mayamorning123 | last post by:
A comparison among six VSS remote tools including SourceOffSite , SourceAnyWhere, VSS Connect, SourceXT, VSS Remoting, VSS.NET To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool This article makes a detailed comparison among SourceAnyWhere 4.0, SourceOffSite 4.1, VSS Connect 1.5, SourceXT 2.1, VSS Remoting 2.5,
0
3282
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool including SourceOffSite, SourceAnyWhere and VSS Remoting This article makes a detailed comparison among SourceAnyWhere, SourceOffSite, VSS Remoting and possible others.
6
1818
by: Dan V. | last post by:
Is there a way to query a remote xml file periodically by not using web services? For Windows and Unix platforms. Is there a cheap software product that I can install on each client and my Windows 2000 server and have 'secure' network access? I would love to use VS.NET to access both windows and Unix/Linux xml files.
14
2533
by: Brent Burkart | last post by:
I am trying to capture the Windows Authenticated username, but I want to be able to capture the login name that exists in IIS, not Windows. In order to enter my company's intranet through the internet, they have to login. I want to be able to capture that login versus their Windows login because I need to know who they are from any computer rather than only their computer. Any ideas? Thanks
6
2254
by: doublemaster007 | last post by:
Is there any debugger in which i can remotly debug Linux exe in windows system...i mean debugger should be in windows and connect to Linux machin in which the executable is running..! is there any thing like that? is this kind of tool possible to develop??
3
9052
by: Scott | last post by:
I have a requirement to control a firefox web browser from an external python program. The python program running under linux from a command shell needs to first find all open firefox web browser windows read the URL currently displayed in each web browser and if the URL matches a particular regular expression it needs to get/set form fields displayed in the web browser. Basically I need something like Windows COM and Internet Explorer...
0
1529
by: bruce | last post by:
hi mike.... you might look at/into selenium, or firewatir.... check the spellings! -peace -----Original Message-----
0
8380
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8296
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8710
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7310
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2721
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1928
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.