Re: Re: [Fwd: PHP Fatal error: php-gtk: Could not open display in Unknownon line 0]

From: Date: Mon, 03 Mar 2008 18:58:13 +0000
Subject: Re: Re: [Fwd: PHP Fatal error: php-gtk: Could not open display in Unknownon line 0]
References: 1 2  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-4157@lists.php.net to get a copy of this message
we have heard all of this before. i know it because i said it. <insert the most giant tounge sticking out emoticon in the world.> From Configuring PHP for GTK <http://oops.opsat.net/doc/gtk/configure-php.html>: ============================== Why a PHP-GTK Config? On Unix based systems, it is a good idea to have a separate PHP config file just for GTK. Why? * Not all command line programs need GTK. Why waste time loading the GTK library if the command line program is not even going to to use it? With PHP you need all the speed you can get. * Apache Will Die. GTK connects to the window manager when loaded. Apache does not have access to any window manager, therefore GTK will kill Apache. Apache = Web. GTK = Local. * Your SSH sessions could break. Over SSH you generally are not using GUI applications, even though you can with X11 forwarding. There are two problems with this. They are not PHP-GTK problems persay, they are just generic problems with remote shells. o X11 Forwarding Is Disabled.
     If this is the case you cannot use any GUI program over
     SSH. If PHP is loading GTK it will die because obviously
     it cannot find a X Session to connect with even if you are
     just using the CLI and do not even use GTK.
     [bob@kathryn ~]$ php
     Could not startup.
o The SSH session is not 'trusted'. If the connection is not
     from what SSHD considers a 'trusted host' then GUI applications
     will be lagged, and GDK will throw errors out. This is true of
     any GTK program no matter what language it was written in. Again
     if you have PHP-GTK loaded for all CLI apps even if you do not
     need it, you will get the aforementioned GDK errors.
     [bob@kathryn ~]$ php
     (-:61599): Gdk-WARNING **: Connection to display localhost:10.0
     appears to be untrusted. Pointer and keyboard grabs and
     inter-client communication may not work as expected.
o X11 Forwarding on a trusted session.
     This is the only time it will work right. Problem is you have to
     manually configure this in SSHD to make it happen and if you are
     not admin of the PC then you are stuck.
Moral of the story? Do not use Apache's PHP.INI, do not use the PHP-CLI.INI. Use a special config file just for GTK. It is not hard to setup. ============================== Then I go on about the Unix shell hashbang, and Windows stand-alone PHP-GTK PHP installations. -- Bob Majdak Jr KateOS Rofflecopter Pilot http://www.kateos.org Elizabeth M Smith wrote: > Andrei Zmievski wrote: >> >> ------------------------------------------------------------------------ >> >> Subject: >> PHP Fatal error: php-gtk: Could not open display in Unknown on line 0 >> From: >> Reindl Harald <h.reindl@thelounge.net> >> Date: >> Mon, 03 Mar 2008 10:37:42 +0100 >> To: >> andrei@php.net >> >> To: >> andrei@php.net >> >> >> >> Hi >> >> If you activate php_gtk in "/etc/php.ini" you will be unable to use >> php for cron-jobs and shellscripts over ssh even until you diable it! >> >> I can not believe taht im the only person who uses php for >> shellscripting :-) >> > > ... for windows we just dump a php-cli.ini in the same directory - > search path stuff makes this work since you'll probably use a separate > binary for cron-jobs and shell scripts on win - on nix it's a bit more > complicated > > Any chance we can hack in a php-gtk.ini so we can totally avoid any issues? > > Elizabeth >

« previous php.gtk.dev (#4157) next »