Simple.  Parameters of the type you described, with the ?, = and &, etc. are specific 
to URLs and are handled by CGI, common gateway interface, i.e. the web server.  See 
the PHP documentation on $argc[] and $argv[] if you want to pass parameters on the 
command line.

Your question mark directly after the file name is confusing DOS.  Parameters on the 
DOS command line need to be separated from the file name by a space.

Essentially, $argc is your argument count and $argv is an array of the values of the 

You won't be able to use $_GET when working with variables from the command line.  It 
wouldn't be wise to design one script that works from either the command line or the 
web browser, plus it would be a major pain in the ass.

Colin Teubner

-----Original Message-----
From: Evan [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 29, 2002 1:07 PM
Subject: [PHP] php.exe from command line

I've made a simple php file that creates a file named 'agent_1.txt' where
the number is taken from $_GET["num"].

I've tried to run it in this way:
And it works perfectly

I thought that from from command line it would work so i tried this (WinXP +
PHP 4.1.2):

c:\php\php.exe c:\Inetpub\webpub\PHP\agent.php?num=1


Can someone help, please?
Thenks in advance,

PHP General Mailing List (
To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to