Re: php.exe from command line
| From: | cteubner at ncw-av dot com | Date: | Mon, 29 Jul 2002 17:13:58 +0000 |
| Subject: | Re: php.exe from command line | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-110217@lists.php.net to get a copy of this message | ||
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.
http://us2.php.net/manual/en/features.commandline.php
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 arguments.
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.
Luck,
Colin Teubner
-----Original Message-----
From: Evan [mailto:evan80@libero.it]
Sent: Monday, July 29, 2002 1:07 PM
To: php-general@lists.php.net
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:
http://localhost/agent.php?num=1
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
BUT IT DOESN'T WORK!!!!! ?
Can someone help, please?
Thenks in advance,
Evan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php