Auto Detection of Environment

From: Date: Thu, 09 Dec 2004 03:56:39 +0000
Subject: Auto Detection of Environment
Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-5322@lists.php.net to get a copy of this message
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). I have a secondary plan already, containing 4 files: myapp-gtk.php (or myapp.php-gtk) - PHP-GTK version myapp-cli.php - CLI version myapp-online.php - Online version myapp.php - central file But, of course, there are two problems with that: a) They have to know what to run; while it makes sense, especially to us PHP veterans (using the term loosely), to a newbie it may not make any sense. There's also the fact that if you've downloaded something called "myapp", wouldn't you click on "myapp.php"? b) It's cumbersome, and requires multiple files... I was wondering if anyone could offer some suggestions on other ways to do this; if I could make it easy for the end-user to figure out, that would be wonderful. I could always rename the 4 files to something different, to remove the confusion, but then it's more confusing for the people who do know what they're doing...*sigh* Thanks in advance, Doug Burkhalter

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