RE: [PHP] Re: Cronjob
> -Original Message- > From: Daren Cotter [mailto:[EMAIL PROTECTED]] > Sent: 25 September 2002 20:11 I know your real problem has been solved, but this might save you from wasting time inspecting the wrong line of code one day: > There isn't even a line 3 in the script: Errr... 1 The error you got is because the $GLOBALS array is itself global, so contains a reference to itself, which could cause infinite looping if PHP didn't detect it and throw that error! Incidentally, both var_dump() and print_r() output useful information about what's in a variable, but in both cases the output is formatted using regular newlines and spaces, with no HTML layout, so for large arrays such as $GLOBALS it's best to do something like: echo ""; print_r($GLOBALS); echo ""; The output from this is actually formatted rather nicely, and is quite easy to read (and can be very informative!). Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Cronjob
Don, It was not there anywhere. --- Don Read <[EMAIL PROTECTED]> wrote: > > On 25-Sep-2002 Daren Cotter wrote: > > This just prints out a bunch of info (seems to be > > unimportant)...what am I looking for in this? > > > > You're looking for your argument string "blah" > > -- > Don Read > [EMAIL PROTECTED] > -- "Beer is proof that God loves us and wants us to > be happy." __ 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
Re: [PHP] Re: Cronjob
On 25-Sep-2002 Daren Cotter wrote: > This just prints out a bunch of info (seems to be > unimportant)...what am I looking for in this? > You're looking for your argument string "blah" -- Don Read [EMAIL PROTECTED] -- "Beer is proof that God loves us and wants us to be happy." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Cronjob
This just prints out a bunch of info (seems to be unimportant)...what am I looking for in this? --- Don Read <[EMAIL PROTECTED]> wrote: > > On 25-Sep-2002 Daren Cotter wrote: > > Holy wowsers...about 5 pages of jibberish printed > out, > > and at the end: > > > > Warning: Nesting level too deep - > recursive > > dependency? in test.php on line > 3 > > > > There isn't even a line 3 in the script: > > > > > var_dump($argv); > > var_dump($GLOBALS); > > ?> > > > > Sorry my mistake, make that : > > print_r($GLOBALS); > > > > -- > Don Read > [EMAIL PROTECTED] > -- "Beer is proof that God loves us and wants us to > be happy." __ 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
Re: [PHP] Re: Cronjob
On 25-Sep-2002 Daren Cotter wrote: > Holy wowsers...about 5 pages of jibberish printed out, > and at the end: > > Warning: Nesting level too deep - recursive > dependency? in test.php on line 3 > > There isn't even a line 3 in the script: > > var_dump($argv); > var_dump($GLOBALS); > ?> > Sorry my mistake, make that : print_r($GLOBALS); -- Don Read [EMAIL PROTECTED] -- "Beer is proof that God loves us and wants us to be happy." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Cronjob
Holy wowsers...about 5 pages of jibberish printed out, and at the end: Warning: Nesting level too deep - recursive dependency? in test.php on line 3 There isn't even a line 3 in the script: --- Don Read <[EMAIL PROTECTED]> wrote: > > On 25-Sep-2002 Daren Cotter wrote: > > Jason, > > > > That's exactly what I'm trying to do, and it's not > > working: > > > > My Script: > >#!/usr/bin/php -f > > > $test = $argv[1]; > > print $test; > > $demo = "This Works"; > > print $demo; > > ?> > > > > Running: > > ./test.php blah > > > > Yiels only "This Works", but not "blah". > > > > I'm using version 4.0.6 > > > > try > > var_dump($argv); > var_dump($GLOBALS); > > > > --- Jason Young <[EMAIL PROTECTED]> 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? > >> > > >> > --- Jason Young <[EMAIL PROTECTED]> wrote: > >> > > >> >>Sorry to butt in :) > >> >> > >> >>Arguments to web scripts are done in the > format: > >> >>page.php?arg1=data1&arg2=data2 > >> >> > >> >>So you would use that full string as the lynx > >> path. > >> >> > >> >>Hope this helps :) > >> >>-Jason > >> >> > >> >>Daren Cotter wrote: > >> >> > >> >>>Thanks for the info Chris, it works! > >> >>> > >> >>>How do I pass arguments to the script? I'm > >> >> > >> >>assuming > >> >> > >> >>>it'd just be: > >> >>> > >> >>>test.php arg1 arg2 > >> >>> > >> >>>The stuff I've read says $argc should be the > >> count > >> >> > >> >>of > >> >> > >> >>>the # of arguments, and $argv should be an > array > >> >>>holding them...but when I do a simple: > >> >>>print "# of Arguments: $argc\n"; > >> >>>It prints nothing, not even 0 > >> >>> > >> >>> > >> >>>--- Chris Hewitt <[EMAIL PROTECTED]> > >> >> > >> >>wrote: > >> >> > >> >On Wed, 25 Sep 2002, Daren Cotter wrote: > >> > > >> > > >> > > >> >>My problem, is that I absolutely NEED to > run a > >> > > >> >>PHP > >> >> > >> >>script using crontab. The script needs to > send > >> >>numerous queries to a database every hour. > Is > >> > > >> there > >> > >> > >> >>any way I can accomplish this, directly or > >> > > >> indirectly? > >> > >> Are you sure its not already there? Commonly > in > >> /usr/bin. Try a "which > >> php" and see if it finds anything? > >> > >> HTH > >> Chris > >> > >> >>> > >> >>> > >> >>> > >> > __ > >> >>>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 > >> >> > >> > > >> > > >> > > >> > > __ > >> > 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 > >> > > > > > > __ > > 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 > > -- > Don Read > [EMAIL PROTECTED] > -- "Beer is proof that God loves us and wants us to > be happy." __ 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
Re: [PHP] Re: Cronjob
Daren Cotter wrote: > > In any case, register_globals is ON for my server. > > I don't understand why this isn't working? I'm doing > exactly what the manual says. What could I be missing? No idea the following worked as expected for me: Script: Execute: php foo.php blah Output: X-Powered-By: PHP/4.1.2 Content-type: text/html blahThis Works Cheers, 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
Re: [PHP] Re: Cronjob
On 25-Sep-2002 Daren Cotter wrote: > Jason, > > That's exactly what I'm trying to do, and it's not > working: > > My Script: >#!/usr/bin/php -f > $test = $argv[1]; > print $test; > $demo = "This Works"; > print $demo; > ?> > > Running: > ./test.php blah > > Yiels only "This Works", but not "blah". > > I'm using version 4.0.6 > try var_dump($argv); var_dump($GLOBALS); > > --- Jason Young <[EMAIL PROTECTED]> 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? >> > >> > --- Jason Young <[EMAIL PROTECTED]> wrote: >> > >> >>Sorry to butt in :) >> >> >> >>Arguments to web scripts are done in the format: >> >>page.php?arg1=data1&arg2=data2 >> >> >> >>So you would use that full string as the lynx >> path. >> >> >> >>Hope this helps :) >> >>-Jason >> >> >> >>Daren Cotter wrote: >> >> >> >>>Thanks for the info Chris, it works! >> >>> >> >>>How do I pass arguments to the script? I'm >> >> >> >>assuming >> >> >> >>>it'd just be: >> >>> >> >>>test.php arg1 arg2 >> >>> >> >>>The stuff I've read says $argc should be the >> count >> >> >> >>of >> >> >> >>>the # of arguments, and $argv should be an array >> >>>holding them...but when I do a simple: >> >>>print "# of Arguments: $argc\n"; >> >>>It prints nothing, not even 0 >> >>> >> >>> >> >>>--- Chris Hewitt <[EMAIL PROTECTED]> >> >> >> >>wrote: >> >> >> >On Wed, 25 Sep 2002, Daren Cotter wrote: >> > >> > >> > >> >>My problem, is that I absolutely NEED to run a >> > >> >>PHP >> >> >> >>script using crontab. The script needs to send >> >>numerous queries to a database every hour. Is >> > >> there >> >> >> >>any way I can accomplish this, directly or >> > >> indirectly? >> >> Are you sure its not already there? Commonly in >> /usr/bin. Try a "which >> php" and see if it finds anything? >> >> HTH >> Chris >> >> >>> >> >>> >> >>> >> __ >> >>>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 >> >> >> > >> > >> > >> > __ >> > 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 >> > > > __ > 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 -- Don Read [EMAIL PROTECTED] -- "Beer is proof that God loves us and wants us to be happy." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Cronjob
In any case, register_globals is ON for my server. I don't understand why this isn't working? I'm doing exactly what the manual says. What could I be missing? --- Robert Cummings <[EMAIL PROTECTED]> wrote: > Nope, $GLOBALS remains as always... > > > http://www.php.net/manual/en/language.variables.predefined.php#language.variables.superglobals > > Cheers, > Rob. > > Jason Young wrote: > > > > Jeez.. pardon me.. $_GLOBALS .. I don't know > where I got SERVER from.. > > *sleeps before posting from now on* > > > > -J > > > > Jason Young wrote: > > > Correction.. isn't it $_SERVER and not $SERVER > > > > > > Jason Young wrote: > > > > > >> Daren, > > >> > > >> This post from Robert explains why you're > having trouble :) > > >> > > >> I forgot the PHP version on my machine doesn't > have the > > >> register_globals problem. > > >> > > >> THAT should work. > > >> > > >> -Jason > > >> > > >>> > > >>> 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. > > >> > > >> > > >> > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: > http://www.php.net/unsub.php > > -- > .-. > | 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
Re: [PHP] Re: Cronjob
Nope, $GLOBALS remains as always... http://www.php.net/manual/en/language.variables.predefined.php#language.variables.superglobals Cheers, Rob. Jason Young wrote: > > Jeez.. pardon me.. $_GLOBALS .. I don't know where I got SERVER from.. > *sleeps before posting from now on* > > -J > > Jason Young wrote: > > Correction.. isn't it $_SERVER and not $SERVER > > > > Jason Young wrote: > > > >> Daren, > >> > >> This post from Robert explains why you're having trouble :) > >> > >> I forgot the PHP version on my machine doesn't have the > >> register_globals problem. > >> > >> THAT should work. > >> > >> -Jason > >> > >>> > >>> 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. > >> > >> > >> > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- .-. | 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
Re: [PHP] Re: Cronjob
Jeez.. pardon me.. $_GLOBALS .. I don't know where I got SERVER from.. *sleeps before posting from now on* -J Jason Young wrote: > Correction.. isn't it $_SERVER and not $SERVER > > Jason Young wrote: > >> Daren, >> >> This post from Robert explains why you're having trouble :) >> >> I forgot the PHP version on my machine doesn't have the >> register_globals problem. >> >> THAT should work. >> >> -Jason >> >>> >>> 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. >> >> >> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Cronjob
Correction.. isn't it $_SERVER and not $SERVER Jason Young wrote: > Daren, > > This post from Robert explains why you're having trouble :) > > I forgot the PHP version on my machine doesn't have the register_globals > problem. > > THAT should work. > > -Jason > >> >> 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. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Cronjob
Daren, This post from Robert explains why you're having trouble :) I forgot the PHP version on my machine doesn't have the register_globals problem. THAT should work. -Jason > > 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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Cronjob
Robert, This does not work, but thanks anyway =) Script: 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
Re: [PHP] Re: Cronjob
I'm using a PHP script. I got a PHP script to run mysql queries no problem, but the trouble is I need to pass off arguments to the script (those arguments shape the queries). --- Mike Dunlop <[EMAIL PROTECTED]> wrote: > Darren, > > Do you want to use a shell script or a php page to > run your queries? > > - MD > > >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? > > > >--- Jason Young <[EMAIL PROTECTED]> wrote: > >> Sorry to butt in :) > >> > >> Arguments to web scripts are done in the format: > >> page.php?arg1=data1&arg2=data2 > >> > >> So you would use that full string as the lynx > path. > >> > >> Hope this helps :) > >> -Jason > >> > >> Daren Cotter wrote: > >> > Thanks for the info Chris, it works! > >> > > >> > How do I pass arguments to the script? I'm > >> assuming > >> > it'd just be: > >> > > >> > test.php arg1 arg2 > >> > > >> > The stuff I've read says $argc should be the > count > >> of > >> > the # of arguments, and $argv should be an > array > >> > holding them...but when I do a simple: > >> > print "# of Arguments: $argc\n"; > >> > It prints nothing, not even 0 > >> > > >> > > >> > --- Chris Hewitt <[EMAIL PROTECTED]> > >> wrote: > >> > > >> >>> > >> >>>On Wed, 25 Sep 2002, Daren Cotter wrote: > >> >>> > >> >>> > >> My problem, is that I absolutely NEED to run > a > >> PHP > >> script using crontab. The script needs to > send > >> numerous queries to a database every hour. > Is > >> >>> > >> >>there > >> >> > >> any way I can accomplish this, directly or > >> >>> > >> >>indirectly? > >> >> > >> >>Are you sure its not already there? Commonly > in > >> >>/usr/bin. Try a "which > >> >>php" and see if it finds anything? > >> >> > >> >>HTH > >> >>Chris > >> >> > >> > > >> > > >> > > >> > > __ > >> > 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 > >> > > > > > >__ > >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 > > > -- > Mike Dunlop > Webmaster > Animation World Network > [EMAIL PROTECTED] > http://www.awn.com > (323) 606-4238 office > (323) 466-6619 fax > 6525 Sunset Blvd. GS10 Los Angeles, CA 90028 > USA > > > -- > 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
Re: [PHP] Re: Cronjob
Jason, That's exactly what I'm trying to do, and it's not working: My Script: #!/usr/bin/php -f Running: ./test.php blah Yiels only "This Works", but not "blah". I'm using version 4.0.6 --- Jason Young <[EMAIL PROTECTED]> 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? > > > > --- Jason Young <[EMAIL PROTECTED]> wrote: > > > >>Sorry to butt in :) > >> > >>Arguments to web scripts are done in the format: > >>page.php?arg1=data1&arg2=data2 > >> > >>So you would use that full string as the lynx > path. > >> > >>Hope this helps :) > >>-Jason > >> > >>Daren Cotter wrote: > >> > >>>Thanks for the info Chris, it works! > >>> > >>>How do I pass arguments to the script? I'm > >> > >>assuming > >> > >>>it'd just be: > >>> > >>>test.php arg1 arg2 > >>> > >>>The stuff I've read says $argc should be the > count > >> > >>of > >> > >>>the # of arguments, and $argv should be an array > >>>holding them...but when I do a simple: > >>>print "# of Arguments: $argc\n"; > >>>It prints nothing, not even 0 > >>> > >>> > >>>--- Chris Hewitt <[EMAIL PROTECTED]> > >> > >>wrote: > >> > >On Wed, 25 Sep 2002, Daren Cotter wrote: > > > > > > > >>My problem, is that I absolutely NEED to run a > > > >>PHP > >> > >>script using crontab. The script needs to send > >>numerous queries to a database every hour. Is > > > there > > > >>any way I can accomplish this, directly or > > > indirectly? > > Are you sure its not already there? Commonly in > /usr/bin. Try a "which > php" and see if it finds anything? > > HTH > Chris > > >>> > >>> > >>> > >>>__ > >>>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 > >> > > > > > > > > __ > > 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 > __ 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
Re: [PHP] Re: Cronjob
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
Re: [PHP] Re: Cronjob
Darren, Do you want to use a shell script or a php page to run your queries? - MD >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? > >--- Jason Young <[EMAIL PROTECTED]> wrote: >> Sorry to butt in :) >> >> Arguments to web scripts are done in the format: >> page.php?arg1=data1&arg2=data2 >> >> So you would use that full string as the lynx path. >> >> Hope this helps :) >> -Jason >> >> Daren Cotter wrote: >> > Thanks for the info Chris, it works! >> > >> > How do I pass arguments to the script? I'm >> assuming >> > it'd just be: >> > >> > test.php arg1 arg2 >> > >> > The stuff I've read says $argc should be the count >> of >> > the # of arguments, and $argv should be an array >> > holding them...but when I do a simple: >> > print "# of Arguments: $argc\n"; >> > It prints nothing, not even 0 >> > >> > >> > --- Chris Hewitt <[EMAIL PROTECTED]> >> wrote: >> > >> >>> >> >>>On Wed, 25 Sep 2002, Daren Cotter wrote: >> >>> >> >>> >> My problem, is that I absolutely NEED to run a >> PHP >> script using crontab. The script needs to send >> numerous queries to a database every hour. Is >> >>> >> >>there >> >> >> any way I can accomplish this, directly or >> >>> >> >>indirectly? >> >> >> >>Are you sure its not already there? Commonly in >> >>/usr/bin. Try a "which >> >>php" and see if it finds anything? >> >> >> >>HTH >> >>Chris >> >> >> > >> > >> > >> > __ >> > 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 >> > > >__ >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 -- Mike Dunlop Webmaster Animation World Network [EMAIL PROTECTED] http://www.awn.com (323) 606-4238 office (323) 466-6619 fax 6525 Sunset Blvd. GS10 Los Angeles, CA 90028 USA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Cronjob
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: 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? > > --- Jason Young <[EMAIL PROTECTED]> wrote: > >>Sorry to butt in :) >> >>Arguments to web scripts are done in the format: >>page.php?arg1=data1&arg2=data2 >> >>So you would use that full string as the lynx path. >> >>Hope this helps :) >>-Jason >> >>Daren Cotter wrote: >> >>>Thanks for the info Chris, it works! >>> >>>How do I pass arguments to the script? I'm >> >>assuming >> >>>it'd just be: >>> >>>test.php arg1 arg2 >>> >>>The stuff I've read says $argc should be the count >> >>of >> >>>the # of arguments, and $argv should be an array >>>holding them...but when I do a simple: >>>print "# of Arguments: $argc\n"; >>>It prints nothing, not even 0 >>> >>> >>>--- Chris Hewitt <[EMAIL PROTECTED]> >> >>wrote: >> >On Wed, 25 Sep 2002, Daren Cotter wrote: > > > >>My problem, is that I absolutely NEED to run a > >>PHP >> >>script using crontab. The script needs to send >>numerous queries to a database every hour. Is > there >>any way I can accomplish this, directly or > indirectly? Are you sure its not already there? Commonly in /usr/bin. Try a "which php" and see if it finds anything? HTH Chris >>> >>> >>> >>>__ >>>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 >> > > > > __ > 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
Re: [PHP] Re: Cronjob
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? --- Jason Young <[EMAIL PROTECTED]> wrote: > Sorry to butt in :) > > Arguments to web scripts are done in the format: > page.php?arg1=data1&arg2=data2 > > So you would use that full string as the lynx path. > > Hope this helps :) > -Jason > > Daren Cotter wrote: > > Thanks for the info Chris, it works! > > > > How do I pass arguments to the script? I'm > assuming > > it'd just be: > > > > test.php arg1 arg2 > > > > The stuff I've read says $argc should be the count > of > > the # of arguments, and $argv should be an array > > holding them...but when I do a simple: > > print "# of Arguments: $argc\n"; > > It prints nothing, not even 0 > > > > > > --- Chris Hewitt <[EMAIL PROTECTED]> > wrote: > > > >>> > >>>On Wed, 25 Sep 2002, Daren Cotter wrote: > >>> > >>> > My problem, is that I absolutely NEED to run a > PHP > script using crontab. The script needs to send > numerous queries to a database every hour. Is > >>> > >>there > >> > any way I can accomplish this, directly or > >>> > >>indirectly? > >> > >>Are you sure its not already there? Commonly in > >>/usr/bin. Try a "which > >>php" and see if it finds anything? > >> > >>HTH > >>Chris > >> > > > > > > > > __ > > 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 > __ 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
Re: [PHP] Re: Cronjob
Sorry to butt in :) Arguments to web scripts are done in the format: page.php?arg1=data1&arg2=data2 So you would use that full string as the lynx path. Hope this helps :) -Jason Daren Cotter wrote: > Thanks for the info Chris, it works! > > How do I pass arguments to the script? I'm assuming > it'd just be: > > test.php arg1 arg2 > > The stuff I've read says $argc should be the count of > the # of arguments, and $argv should be an array > holding them...but when I do a simple: > print "# of Arguments: $argc\n"; > It prints nothing, not even 0 > > > --- Chris Hewitt <[EMAIL PROTECTED]> wrote: > >>> >>>On Wed, 25 Sep 2002, Daren Cotter wrote: >>> >>> My problem, is that I absolutely NEED to run a PHP script using crontab. The script needs to send numerous queries to a database every hour. Is >>> >>there >> any way I can accomplish this, directly or >>> >>indirectly? >> >>Are you sure its not already there? Commonly in >>/usr/bin. Try a "which >>php" and see if it finds anything? >> >>HTH >>Chris >> > > > > __ > 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
Re: [PHP] Re: Cronjob
Thanks for the info Chris, it works! How do I pass arguments to the script? I'm assuming it'd just be: test.php arg1 arg2 The stuff I've read says $argc should be the count of the # of arguments, and $argv should be an array holding them...but when I do a simple: print "# of Arguments: $argc\n"; It prints nothing, not even 0 --- Chris Hewitt <[EMAIL PROTECTED]> wrote: > > > > > >On Wed, 25 Sep 2002, Daren Cotter wrote: > > > >> > >>My problem, is that I absolutely NEED to run a PHP > >>script using crontab. The script needs to send > >>numerous queries to a database every hour. Is > there > >>any way I can accomplish this, directly or > indirectly? > >> > Are you sure its not already there? Commonly in > /usr/bin. Try a "which > php" and see if it finds anything? > > HTH > Chris > __ 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
Re: [PHP] Re: Cronjob
-dump is an option to lynx to tell it to output the page and quits. the rest of it says send all output (and errors) to /dev/null On Wed, 25 Sep 2002, Daren Cotter wrote: > What does the "-dump" and ">/dev/null 2>&1" stuff do? > > --- Philip Hallstrom <[EMAIL PROTECTED]> wrote: > > You could setup cron to run lynx or some other > > command line web browser... > > something like: > > > > 0 * * * * /path/to/lynx -dump > > http://server/path/to/script.php >/dev/null 2>&1 > > > > Then as the first thing in that script you will > > probably want to set the > > time limit to 0 so it doesn't time out... > > > > > > > > On Wed, 25 Sep 2002, Daren Cotter wrote: > > > > > I have PHP installed on a Cobalt RaQ550. I know > > there > > > are two ways of installing PHP, one as a binary, > > and > > > one as an Apache module. I am pretty sure PHP gets > > > installed as an Apache module for the Cobalt > > > installation. > > > > > > My problem, is that I absolutely NEED to run a PHP > > > script using crontab. The script needs to send > > > numerous queries to a database every hour. Is > > there > > > any way I can accomplish this, directly or > > indirectly? > > > > > > __ > > > 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 > > > > > > > > > -- > > 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
Re: [PHP] Re: Cronjob
> > >On Wed, 25 Sep 2002, Daren Cotter wrote: > >> >>My problem, is that I absolutely NEED to run a PHP >>script using crontab. The script needs to send >>numerous queries to a database every hour. Is there >>any way I can accomplish this, directly or indirectly? >> Are you sure its not already there? Commonly in /usr/bin. Try a "which php" and see if it finds anything? HTH Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Cronjob
What does the "-dump" and ">/dev/null 2>&1" stuff do? --- Philip Hallstrom <[EMAIL PROTECTED]> wrote: > You could setup cron to run lynx or some other > command line web browser... > something like: > > 0 * * * * /path/to/lynx -dump > http://server/path/to/script.php >/dev/null 2>&1 > > Then as the first thing in that script you will > probably want to set the > time limit to 0 so it doesn't time out... > > > > On Wed, 25 Sep 2002, Daren Cotter wrote: > > > I have PHP installed on a Cobalt RaQ550. I know > there > > are two ways of installing PHP, one as a binary, > and > > one as an Apache module. I am pretty sure PHP gets > > installed as an Apache module for the Cobalt > > installation. > > > > My problem, is that I absolutely NEED to run a PHP > > script using crontab. The script needs to send > > numerous queries to a database every hour. Is > there > > any way I can accomplish this, directly or > indirectly? > > > > __ > > 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 > > > > > -- > 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