user2977468
user2977468

Reputation: 183

php CLI arguments Issues

I'm working on a command-line script for a php app.

I can't get it to successfully accept params.

(via ssh)
If I type:
/: php testFile.php arg1 arg2 arg3

I receive the following errors: Notice: Undefined variable: agrc in /testFile.php on line 3 Notice: Undefined variable: agrv in /testFile.php on line 3

Here's the current code:

<?php
echo ini_get('register_argc_argv');
print_r( $agrc );print_r( $agrv );
?>

I also confirmed that the 'register_argc_argv' directive is TRUE

What am I over looking ?

Thanks in advance.

Upvotes: 1

Views: 382

Answers (1)

Pedro Lobito
Pedro Lobito

Reputation: 99041

Use $_SERVER['argv'] instead of only $agrv.

Upvotes: 2

Related Questions