Robert,

This does not work, but thanks anyway  =)

Script:
<?
$argc = $GLOBALS['HTTP_SERVER_VARS']['argc'];
$argv = $GLOBALS['HTTP_SERVER_VARS']['argv'];

$test = $argv[1];
print $test;

$demo = "This Works";
print $demo;
?>

Command Line:
/usr/bin/php -f test.php blah

Output:
This Works


--- Robert Cummings <[EMAIL PROTECTED]>
wrote:
> Jason Young wrote:
> > 
> > I can't say I'm really too familiar with the php
> commandline..
> > 
> > You're using /usr/bin/php (or equivalent) and
> attempting to use your
> > exec() that way?
> > 
> > If you do 'php -?' you'll get a list of commands
> that you can use, and I
> > don't see a way to pass cmdline arguments as
> variables..
> > 
> > Having said that, I Just went and looked further
> into it.. if I make a
> > test script, and at the top I put:
> > $hi = $argv[1];
> > 
> > then $hi becomes whatever you've specified as the
> first argument.. I'm
> > assuming this is what you want?
> > 
> > To clarify:
> > phpfile.php contains:
> > <?
> > $hi = $argv[1];
> > echo $hi;
> > ?>
> > 
> > Running the command "php -f phpfile.php test"
> returns "test"
> > 
> > Does this help at all??
> > 
> > -Jason
> > 
> > Daren Cotter wrote:
> > > Jason,
> > >
> > > I'm not using a web script any longer, I'm using
> > > command-line (I determined that it is installed
> on the
> > > server).
> > >
> > > I read about $argc and $argv, but when I call
> the
> > > script passing two arguments, both $argc and
> $argv are
> > > blank. Is this a php.ini setting I need to
> change or
> > > somethign?
> > >
> 
> I'm think you're all forgetting about
> register_globals being off by
> default these days... The following may help:
> 
> $argc = $GLOBALS['HTTP_SERVER_VARS']['argc'];
> $argv = $GLOBALS['HTTP_SERVER_VARS']['argv'];
> 
> HTH,
> Rob.
> -- 
> .-----------------.
> | Robert Cummings |
> :-----------------`----------------------------.
> | Webdeployer - Chief PHP and Java Programmer  |
> :----------------------------------------------:
> | Mail  : mailto:[EMAIL PROTECTED] |
> | Phone : (613) 731-4046 x.109                 |
> :----------------------------------------------:
> | Website : http://www.webmotion.com           |
> | Fax     : (613) 260-9545                     |
> `----------------------------------------------'
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to