PHP command line interface ignores my arguments

Forum for you who has PHP installation issues

Moderators: egami, macek, gesf

Post Reply
User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2192
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Mon Aug 22, 2011 6:03 am

argc = count of arguments
argv = value of arguments in an array

Code: Select all

<?

var_dump($argv);

echo "-------------\r\n";

var_dump($argc);

echo "-------------\r\n";

?>

[mybox@tools phpnet]$ php index.php one two three 4

array(5) {
[0]=>
string(9) "index.php"
[1]=>
string(3) "one"
[2]=>
string(3) "two"
[3]=>
string(5) "three"
[4]=>
string(1) "4"
}
-------------
int(5)
-------------

User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2192
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Mon Aug 22, 2011 6:06 am

I don't know much about Windows. Personally, I think Windows has a place in the gaming world, and Office Manipulation, but has no place in the server world. (Except Microsoft Exchange).

But if it's anything like the Unix side of the house,
#!c:/path/to/php.exe

should be the first line.

User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2192
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Tue Aug 23, 2011 6:53 am

Dora,
In the UNIX environment, there are two types of PHP installs. One in CGI mode (regular web) and one in CLI mode. Essentially, they call the same file, but in a different way. In the Windows world, it might be the same way.

A while ago, Nullsig posted a website that had an auto installer which installed the CGI/CLI & WAMP stuffs together, perhaps do a google search on that?

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest