f



ptkdb running from Apache couldn't connect to display "localhost:0.0"

I am having a problem running ptkdb when invoked by a local httpd server.  The script below works ok and will fire up ptkdb ok from a bash shell:

#!/usr/bin/perl -w -d:ptkdb
#!/usr/bin/perl -wT

$|++;

# for debugger when httpd invokes CGI
#sub BEGIN {$ENV{DISPLAY} = "localhost:0.0"; };

use strict;


print "Content-type: text/html\n\n";

use CGI;
use FindBin;
my $scriptdir = "$FindBin::Bin";
my $tmpldir =  "$scriptdir/../templates/";
use lib "/home/owain/www/v2/perl-lib";

my $q = new CGI;
my $t = new_template("hello.tmpl");


my $script = $q->param("script") || "Initial";
my @loop = qw (home about help players);
my @items;
while (@loop) {
  push @items, {action => shift @loop};

}
$t->param(script=> $script,menu => \@items);
print $t->output();                        

exit;

When I run it through a browser I get the following:

[Wed Jul 14 22:02:01 2004] [error] [client 10.0.0.2] Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/5.8.3/Devel/ptkdb.pm line 1120.
[Wed Jul 14 22:02:07 2004] [error] [client 10.0.0.2] couldn't connect to display "localhost:0.0" at /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi/Tk/MainWindow.pm line 55.
[Wed Jul 14 22:02:07 2004] [error] [client 10.0.0.2] MainWindow->new() at /usr/lib/perl5/5.8.3/Devel/ptkdb.pm line 1147
[Wed Jul 14 22:02:07 2004] [error] [client 10.0.0.2] Can't call method "setup_main_window" on unblessed reference at /usr/lib/perl5/5.8.3/Devel/ptkdb.pm line 4151.
[Wed Jul 14 22:02:07 2004] [error] [client 10.0.0.2] END failed--call queue aborted.
[Wed Jul 14 22:02:07 2004] [error] [client 10.0.0.2] Premature end of script headers: index.cgi

I have the following setup:

Apache 2.0.49
Perl 5.8.3
Tk 804.027
ptkdb 1.1091
Fedora Core 1 with all the patches applied

My reasoning is as follows:

1.  ptkdb is installed ok with tk since it works fine from a bash shell under my userid
2.  i have added all of the xhosts I can
3.  changed httpd user to mine to see if that works
4.  set env variable for apache virtual host just in case it was some sort of tainting problem on ENV which came up in googlegroups.
5.  got to be some sort of X security thing???? And I don't really understand how this works.

Any ideas out there?

Thanks,

Owain.
0
Owain
7/14/2004 9:55:28 PM
comp.lang.perl.tk 4721 articles. 0 followers. pharrendorf (19) is leader. Post Follow

3 Replies
827 Views

Similar Articles

[PageSpeed] 54

On Wed, 14 Jul 2004 22:55:28 +0100, Owain
<owain@delthis.ofrm.demon.co.uk> wrote:

>I am having a problem running ptkdb when invoked by a local httpd server.  The script below works ok and will fire up ptkdb ok from a bash shell:
>
>#!/usr/bin/perl -w -d:ptkdb
>#!/usr/bin/perl -wT
>
>$|++;
>
># for debugger when httpd invokes CGI
>#sub BEGIN {$ENV{DISPLAY} = "localhost:0.0"; };
>
>use strict;
>
>
>print "Content-type: text/html\n\n";
>
>
>My reasoning is as follows:
>
>1.  ptkdb is installed ok with tk since it works fine from a bash shell under my userid
>2.  i have added all of the xhosts I can
>3.  changed httpd user to mine to see if that works
>4.  set env variable for apache virtual host just in case it was some sort of tainting problem on ENV which came up in googlegroups.
>5.  got to be some sort of X security thing???? And I don't really understand how this works.
>
>Any ideas out there?

Yes, it probably is X security. You need to issue the command 
"xhosts +"  to let the X server receive input from the web server.

Most X setups have it turned off by default because of potential
security risks.  

I'm not positive about this next point, but I'll mention it. Alot of 
X start up scripts will be aliased " startx -- -nolisten tcp" to prevent
the X server from accepting tcp connections. If the "xhosts +" dosn't
work, see if your X server is started with "nolisten tcp".



-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
0
zentara
7/15/2004 12:50:11 PM
So the answer was.  Check the /var/log/XFree86.0.log

and in it said rejected connection from 127.0.0.1.  So I xhost 127.0.0.1
and it worked.  So localhost in /etc/host wasn't being used.  I also moved
the environment variable DISPLAY to be set in the apache httpd.conf file
for the virtual host file since it would be nice not to have to interfere
with the perl code just for debugging.

Hope this helps someone else. 




On Thu, 15 Jul 2004 08:50:11 -0400, zentara wrote:

> On Wed, 14 Jul 2004 22:55:28 +0100, Owain
> <owain@delthis.ofrm.demon.co.uk> wrote:
> 
>>I am having a problem running ptkdb when invoked by a local httpd server.  The script below works ok and will fire up ptkdb ok from a bash shell:
>>
>>#!/usr/bin/perl -w -d:ptkdb
>>#!/usr/bin/perl -wT
>>
>>$|++;
>>
>># for debugger when httpd invokes CGI
>>#sub BEGIN {$ENV{DISPLAY} = "localhost:0.0"; };
>>
>>use strict;
>>
>>
>>print "Content-type: text/html\n\n";
>>
>>
>>My reasoning is as follows:
>>
>>1.  ptkdb is installed ok with tk since it works fine from a bash shell under my userid
>>2.  i have added all of the xhosts I can
>>3.  changed httpd user to mine to see if that works
>>4.  set env variable for apache virtual host just in case it was some sort of tainting problem on ENV which came up in googlegroups.
>>5.  got to be some sort of X security thing???? And I don't really understand how this works.
>>
>>Any ideas out there?
> 
> Yes, it probably is X security. You need to issue the command 
> "xhosts +"  to let the X server receive input from the web server.
> 
> Most X setups have it turned off by default because of potential
> security risks.  
> 
> I'm not positive about this next point, but I'll mention it. Alot of 
> X start up scripts will be aliased " startx -- -nolisten tcp" to prevent
> the X server from accepting tcp connections. If the "xhosts +" dosn't
> work, see if your X server is started with "nolisten tcp".

0
Owain
7/27/2004 3:44:36 PM
Owain <owain@delthis.ofrm.demon.co.uk> wrote in message news:<pan.2004.07.14.21.55.25.76204@delthis.ofrm.demon.co.uk>...
> I am having a problem running ptkdb when invoked by a local httpd server.  The script below works ok and will fire up ptkdb ok from a bash shell:
> 
> #!/usr/bin/perl -w -d:ptkdb
> #!/usr/bin/perl -wT
> 
> $|++;
> 
> # for debugger when httpd invokes CGI
> #sub BEGIN {$ENV{DISPLAY} = "localhost:0.0"; };
> 
> use strict;
> 
> 
> print "Content-type: text/html\n\n";
> 
> use CGI;
> use FindBin;
> my $scriptdir = "$FindBin::Bin";
> my $tmpldir =  "$scriptdir/../templates/";
> use lib "/home/owain/www/v2/perl-lib";
> 
> my $q = new CGI;
> my $t = new_template("hello.tmpl");
> 
> 
> my $script = $q->param("script") || "Initial";
> my @loop = qw (home about help players);
> my @items;
> while (@loop) {
>   push @items, {action => shift @loop};
> 
> }
> $t->param(script=> $script,menu => \@items);
> print $t->output();                        
> 
> exit;
> 
> When I run it through a browser I get the following:
> 
> [Wed Jul 14 22:02:01 2004] [error] [client 10.0.0.2] Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/5.8.3/Devel/ptkdb.pm line 1120.
> [Wed Jul 14 22:02:07 2004] [error] [client 10.0.0.2] couldn't connect to display "localhost:0.0" at /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi/Tk/MainWindow.pm line 55.
> [Wed Jul 14 22:02:07 2004] [error] [client 10.0.0.2] MainWindow->new() at /usr/lib/perl5/5.8.3/Devel/ptkdb.pm line 1147
> [Wed Jul 14 22:02:07 2004] [error] [client 10.0.0.2] Can't call method "setup_main_window" on unblessed reference at /usr/lib/perl5/5.8.3/Devel/ptkdb.pm line 4151.
> [Wed Jul 14 22:02:07 2004] [error] [client 10.0.0.2] END failed--call queue aborted.
> [Wed Jul 14 22:02:07 2004] [error] [client 10.0.0.2] Premature end of script headers: index.cgi
> 
> I have the following setup:
> 
> Apache 2.0.49
> Perl 5.8.3
> Tk 804.027
> ptkdb 1.1091
> Fedora Core 1 with all the patches applied
> 
> My reasoning is as follows:
> 
> 1.  ptkdb is installed ok with tk since it works fine from a bash shell under my userid
> 2.  i have added all of the xhosts I can
> 3.  changed httpd user to mine to see if that works
> 4.  set env variable for apache virtual host just in case it was some sort of tainting problem on ENV which came up in googlegroups.
> 5.  got to be some sort of X security thing???? And I don't really understand how this works.
> 

The last one is likely. And I also don't understand the X security model very
well. An idea: there's usually a file ~/.Xauthority with some security cookies.
Maybe it would work if you manage to share this file with the apache process.
The easiest would be to start apache not as "nobody" or "apache" user, but
under your own user id.

Regards,
      Slaven
0
slaven
7/27/2004 6:27:17 PM
Reply:

Similar Artilces:

couldn't connect to display ":0"
--0-2076467981-1086639284=:72215 Content-Type: text/plain; charset=us-ascii help when I run this program: #!/usr/bin/perl -w use strict; use CGI::Carp qw(fatalsToBrowser); use lib '/home/bthcraft/cgi-bin/lib/lib/perl5/site_perl/5.8.0/i386-linux'; use Tk; my $main = new MainWindow; ###barfs here### $main->Label(-text => 'Hello, world!')->pack; $main->Button(-text => 'Quit', -command => sub{exit} )->pack; MainLoop; I recieve the following error Mon Jun 7 13:11:43 2004] test.cgi: couldn't connect to display ":0" at /hom...

RE: couldn't connect to display ":0"
This is a multi-part message in MIME format. ------_=_NextPart_001_01C44CD4.90830B30 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I think that is not a problem with your script, but with the environment = variable DISPLAY that may be set incorrectly. Or if you are running that script from a session window that doesn't let = graphics (spawning windows) though, that is another possibility. =20 Are you running your script from your local host or telnet'ed / rsh'ed ? =20 Iggs -----Original Message----- From: J...

RE: couldn't connect to display ":0" #2
I think the problem is that John is confusing two technologies. Tk is used to interact with a GUI locally (yes, it can display remotely using X-windows if the DISPLAY variable is set to another machine). Contrast this to CGI which is used in a web server environment where there is no display; rather the output is sent back to the requester's browser. So unless you are testing pure locally (i.e. not running under the web server but rather from a command line), this *should* fail. That is why I would say that mixing Tk and CGI is likely a conceptual error on John's part. ...

"some\0\0\0\0\0\0"
can i use such form of adding zeros to the strings/literals to 'pad' them with zeros ? or this is not guwranteed to work? need that for assuring that strings for example arepadded to some amount of bytes thus using fast compare which only checks some amount of data and do not bother for checking ends, etc 9you know what i mean) On Thu, 13 Aug 2015 12:30:19 -0700, fir saw fit to publish the following: > can i use such form of adding zeros to the strings/literals to 'pad' > them with zeros ? Yes you can. (I feel SOOO presidential right now) > or this is n...

Changing ". . . # . # ." into " 0 0 0 1 0 1 0"
Is there an easy way to change ". . . # . # ." into " 0 0 0 1 0 1 0"? i.e. changing an array of dots and hashes that another programme I'm using outputs, into 0s and 1s that I can then use in Matlab? Many thanks, Tom In article <ef19cb8.-1@webx.raydaftYaTP>, Tom <thomas.cole@lincoln.ox.ac.uk> wrote: > Is there an easy way to change ". . . # . # ." into " 0 0 0 1 0 1 0"? > i.e. changing an array of dots and hashes that another programme I'm > using outputs, into 0s and 1s that I can then use in Matlab? > > Many tha...

Terminal wedged: "Can't open display: :0.0"
My X11 just crashed unexpectedly (a very rare occurrence, until recently), and after restarting it, I'm no longer able to start X11 programs from Terminal. I killed and re-started both Terminal and X11, for good measure, but still I get the same error in Terminal; e.g.: % echo $DISPLAY :0.0 % xlogo Error: Can't open display: :0.0 Strangely, if I start xlogo directly from X11's Applications->xlogo menu, the xlogo window pops up fine. So clearly the problem is not with X11; it's running fine. I figure that the DISPLAY variable in my Terminal shell is se...

lynx 'browser' can't do "<?xml version="1.0" encoding="utf-8"?>"
lynx is lighteningly fast to fetch a set of pages [via a script] via dump > fileID. But [my current version] doesn't render the 'style' of: "<?xml version="1.0" encoding="utf-8"?>" What is this new "xml" crap ? Will it likely take over the older *.html ? Thanks for any info, == Chris Glur. news@absamail.co.za wrote in news:1172596265.663611@vasbyt.isdsl.net: > lynx is lighteningly fast to fetch a set of pages [via a script] via > dump > fileID. > > But [my current version] doesn't ...

TSP: intercepting "WSPConnect": value of "name" parameter always "0.0.0.0"?
Hello, using the Microsoft TSP-example and intercepting "WSPConnect" (see code snippet below), I found that I would always get "0.0.0.0" and some random port for the local and remote endpoints. Shouldn't the "name" parameter of "WSPConnect" contain the actual remote IP endpoint to which the user application is connecting to? ----8<------------- SOCKADDR_IN localAddr; SOCKADDR_IN *pRemAddr = (SOCKADDR_IN *)name; int sockAddrLen = sizeof(SOCKADDR_IN); getsockname(SocketContext->ProviderSocket, (SOCKADDR *)&localAddr, &soc...

"XFree86-DRI" missing on display ":0.0"
Hi, I running on: OS: Redhat 9 System: Dell C400 Video card: Intel 830 Driver: i810 I got this error when running a game (armyops). ====================================================== Xlib: extension "XFree86-DRI" missing on display ":0.0". Couldn't set video mode: Couldn't find matching GLX visual History: Exiting due to error ====================================================== How do I enable the hardware 3D acceleration for this video card? Help!!!! Thanks, PL On Thu, 23 Oct 2003 12:31:01 -0...

Fedora 2 "couldn't add command channel 127.0.0.1#953: not found" [solution]
On a laptop, not connected to any network, nor to Internet. Installed Fedora Core 2 from CD's with book "Red Hat Fedora Linux 2 Bible". Selected various web services and Gnome stuff. Booted. As root, started service "named". Result was a "chrooted" ("jailed") service, in "/var/named/chroot". - - - - - What works: 1. Created a file "/var/www/html/index.html", asked browser to show "http://localhost": that page displays. What doesn't work: 1. "host localhost" - times out, can't find a...

ooRexx 4.0.0 using date("F or T") and time("F or T")
Is it right that date("T") and time("T") return the same value? And that date("F") and time("F") return the same value? I think I'd have expected the date() functions to return a value for time 00:00:00 on today's date, and the time() calls to be for the current time on today's date. As it is, the result of date("F") and date("T") are now different at various times in a particular day, which is not the case for - say - date("B"). -- Jeremy C B Nicoll - my opinions are my own. Email sent t...

Tkinter problem: TclError> couldn't connect to display ":0
Hi, I use live Debian on VM and trying to compile this code. import Tkinter root = Tkinter.Tk() root.title("Fenster 1") root.geometry("100x100") root.mainloop() The shell gives out that kind of message: File "test.py", line 5, in <module> root = Tkinter.Tk() File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1712, in __init__ self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) _tkinter.TclError: couldn't connect to display ":0" thanks for helping o...

Xlib: extension "GLX" missing on display ":0.0".
I try to run java 3d 1.2.1 on debian woody, java 1.4.2. Unfortunately, I get the following error. WARNING: Canvas3D constructed with a null GraphicsConfiguration. Xlib: extension "GLX" missing on display ":0.0". Xlib: extension "GLX" missing on display ":0.0". Xlib: extension "GLX" missing on display ":0.0". Xlib: extension "GLX" missing on display ":0.0". java.lang.NullPointerException at javax.media.j3d.Canvas3D.<init>(Canvas3D.java:907) On the web I found the suggestion to uncomment &qu...

Xlib: extension "RENDER"missing on display ":0.0".
I compiled and installed OpenBox and am now running it on Solaris 9/sparc with Xsun. However, it's not working perfectly: the font in the title bars and menus looks like chicken droppings, it's mostly unreadable. The only bit I can read is an entry "Go there" in a specific menu which is shown in italic. On startup of X11, I see the following message: Xlib: extension "RENDER"missing on display ":0.0". I'm pretty sure it comes from OpenBox, since not much else is running (only an xterm and an xconsole). Kai Kai Grossjohann <kai@emptydomain.de&g...

Web resources about - ptkdb running from Apache couldn't connect to display "localhost:0.0" - comp.lang.perl.tk

Resources last updated: 2/6/2016 8:47:00 PM