logo       

RE: PHP Command Line Syntax: msg#00414

Subject: RE: PHP Command Line Syntax
If you're running from the command line, you can use
standard command line arguments.  In the file they'll
be entered into the array $argv[].  $argv[0] is the name
of the script called, and each other argument is
consecutively numbered.

For example the file test.php:

<?  #test.php
print("Arg0 is $argv[0]\nArgv1 is $argv[1]\n");
?>

running: c:\php\php.exe -q test.php SERVERNAME
would print:

Argv0 is test.php
Argv1 is SERVERNAME

If you want to use the same php file on the server as for
command line, just put a check at the start to see if argv
is defined and has elements, and if so, map them to your
QUERY equivalants.
(e.g. if(count(argv)>1) {$servername=$argv[1]}   )

-steve
http://www.cheatcodes.com/
http://www.gear21.com



> -----Original Message-----
> From: Scott Dowd [mailto:scottdowd@xxxxxxxxxxxxxxx]
> Sent: Sunday, April 28, 2002 5:32 AM
> To: php-windows@xxxxxxxxxxxxx
> Subject: [PHP-WIN] PHP Command Line Syntax
>
>
> I would like to schedule a series of PHP pages to run overnight from a
> Win2k/IIS/PHP4 box. An example of the url is
> http://localhost/checklist/checksingle.php?servername=SERVERNAME.
> When I try
> to execute this from a DOS prompt, "C:\PHP\PHP.EXE -q checksingle.php" it
> works fine, but when I add "?servername=SERVERNAME" as in the url, it does
> not recognize the command.
>
> "PHP Fatal error:  Unable to open checksingle.php?servername=SERVERNAME in
> Unknow
> n on line 0"
>
> Is this the best way to schedule a PHP page to run ?
>
> Thanks,
> Scott.
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe