John,

Netscape! Differences between servers AND differences between browsers AND differences 
between in-browser and
command-line operations!
Isn't life fun?

Like you I'm messing around with some of these differences as part of a bid to 
'convert' an existing set of
scripts from browser i/f to command-line. At present I'm putting up with all the HTML 
output - that's a ToDo
'soon' I guess; but have fixed the time-clock base so that everything is converted 
back and forth between
UTC/GMT and local times.

Like you I have rolled-my-own function which uses the following two variables: 
SetSuffix($argv[0],
$GLOBALS[SERVER_NAME]);
$ServerName is used to work out which (Apache) Vserver is running the script, whereas 
$directory is used to work
out where code is being run from (at the command line). The main decision being driven 
from here is whether to
run off the 'production' or 'test' database - I've just tweaked that from code I wrote 
some weeks ago around
another global. I guess I'll now have to emulate your plan and now work out how to 
control all the output, if
not logging, then displaying at the command line/green screen as opposed to the 
browser.

Regards,
=dn

> > Thanks for the idea. I have just resurrected and had another play with my
> 'testbench.php', running it from both
> > IE/Apache and in a DOS box.
> >
> > It includes the following code:
>     [...]
>
> Thanks (also thanks to the others for the useful comments & ideas).
>
> I don't have $HTTP_SERVER_VARS["SERVER_NAME"]
> or $GLOBALS["SERVER_ADDR"] or $SERVER_SOFTWARE
> probably because my server is netscape ("nsapi"?). They
> are all blank. Yes I declared them 'global'.
>
> I ended up with these functions which seem to do the trick, at
> least for my server and NT.
>
> function isonserver()
> {
> global $PHP_SELF,$argc;
>     return $argc==0 && isset($PHP_SELF) && $PHP_SELF;
> }
>
> function getpagename()
> {
> global $PHP_SELF,$argv;
>     return basename(isonserver() ? $PHP_SELF : $argv[0]);
> }
>
> function getlinedelimiter()
> {
>     return isonserver() ? "\n" : "\r\n";
> }
>
> The pagename is critical to my site, because the code needs
> the page name to recognize certain suffixes and 'special page
> names.
>
> Perhaps it is only sufficient to test for $PHP_SELF and not $argc,
> but I threw in $argc==0 anyway.
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to