note 32764 deleted from features.commandline by pollita
| From: | pollita@php.net | Date: | Fri, 06 Jun 2003 04:09:01 +0000 |
| Subject: | note 32764 deleted from features.commandline by pollita | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-49841@lists.php.net to get a copy of this message | ||
Note Submitter: nospam@usdiscount.com
----
I get the following:
[root@web0 zentrack]# php -v
PHP 4.3.2 (cli) (built: Jun 3 2003 23:12:21)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
[root@web0 zentrack]# ./test.php
./test.php: ?php: No such file or directory
./test.php: line 4: syntax error near unexpected token `in_array($argv[1],'
./test.php: line 4: `if ($argc != 2 || in_array($argv[1], array('--help',
'-help', '-h', '-?'))) {'
For some reason it doesn't like the <?php .. I can execute the the file from the
commandline "php test.php" which works.
#!/usr/local/bin/php
<?php
if ($argc != 2 || in_array($argv[1], array('--help', '-help', '-h',
'-?'))) {
?>
This is a command line PHP script with one option.
Usage:
<?php echo $argv[0]; ?> <option>
<option> can be some word you would like
to print out. With the --help, -help, -h,
or -? options, you can get this help.
<?php
} else {
echo $argv[1];
}
?>
The above doesn't work and the path to the php file is correct. ?? Please help?