Re: Re: Cronjob

From: Date: Wed, 25 Sep 2002 18:24:25 +0000
Subject: Re: Re: Cronjob
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-117607@lists.php.net to get a copy of this message
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:robert.cummings@webmotion.com | | Phone : (613) 731-4046 x.109 | :----------------------------------------------: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `----------------------------------------------'

« previous php.general (#117607) next »