Re: Auto Detection of Environment

From: Date: Sat, 11 Dec 2004 17:43:12 +0000
Subject: Re: Auto Detection of Environment
References: 1 2  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-5335@lists.php.net to get a copy of this message
You can't use a check for php_gtk to verify the presense of a graphical/gtk enabled enviroment. The plugin will exist regardless of what enviroment its being run in, However when you try to run show_all there will be an error, I don't remember specificly what that was and don't have gtk installed at the moment to test.. To see this, http://gtk.php.net/manual/en/tutorials.hellow.php run the hello world from your normal x-windows then ctrl-alt-f1 to terminal mode and try running it again. Richard Thomas - CEO Cyberlot Technologies Group Inc. 507.398.4124 - Voice Ciprian Popovici wrote:
On Wed, 8 Dec 2004 21:56:39 -0600 Doug Burkhalter <dougtheneard@gmail.com> wrote:
I'm looking into creating apps with PHP that could be run in three different ways: online, via command line, and through PHP-GTK. I was wondering if there was any "automatic" way to detect what environment it was being run in (online, cli, or GTK).
While on Web, the constant STDIN is not defined, so you can test with defined('STDIN'). Next you can test for GTK either with extension_loaded('php_gtk') or if that doesn't work use function_exists() with a GTK-specific function, or test if the "gtk" class exists, and so on.


« previous php.gtk.general (#5335) next »