Need help with PHP CLI
| From: | [-^-!-%- | Date: | Thu, 13 Feb 2003 11:08:03 +0000 |
| Subject: | Need help with PHP CLI | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-135471@lists.php.net to get a copy of this message | ||
Hello everyone!
I'm having trouble accessing the argument list from a php script,
from the command line.
I'm calling the script as
>>./myscript.php argument1 argument2
myscript.php contains
#!/usr/local/php -q
<?php
echo "Total aguments passed: $argc\n";
echo "Argument 1: $argv[0] \n argument2: $argv[1]";
?>
$argv and $argc both returns blank. I looked at the global variables
($GLOBALS and $GLOBALS[$argv]) and noticed that $ARGC and $ARGV were not
listed.
Am I missing something?
Is this method outdated? i.e. echo $argv[$i].
It seems like $ARGV is not even present, let alone be an array. Please
advise.
I'm using PHP 4.2.3 on Apache 1.23.xx and Linux.
Thanks in advance!
-john
=P e p i e D e s i g n s
www.pepiedesigns.com
Providing Solutions That Increase Productivity
Web Developement. Database. Hosting. Multimedia.