Page 1 of 1

PHP Command line functionality...

Posted: Fri Dec 29, 2006 6:32 am
by icarpenter
Hi

I am trying to execute a PHP script from the commandline but I am having a few issues passing values into the script?

Can anyone help?

know this is wrong but I am trying to push a value into the script, this is what I type from the command line on the server:

Code: Select all

C:\php\php.exe C:\test.php --"$test=value;"
I am trying to catch the value and echo this out to the terminal...this is test.php:-

Code: Select all

echo $test;
Any help would be greatly appreciated!

Thanks Ian

Posted: Fri Dec 29, 2006 7:08 am
by aaronhall
A CLI call would look something like:

php.exe myscript.php argument1 argument2

Arguments do not need to be preceded by any character (a dash or otherwise), and all passed arguments are stored in order in the $_SERVER['argv'] array.

Posted: Mon Jan 01, 2007 12:29 am
by icarpenter
Thats got it!!!

Many thanks aaronhall!!!