Unifined index 'argv' in $_SERVER['argv']

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Unifined index 'argv' in $_SERVER['argv']

Post by kendall »

Hi,

i have noted a $_SERVER parameter called 'argv' which suppose to contian an array of paramters passed via the url

No on trying to access this parameter by passing a querystring url on my local installation of php i get the error
otice: Undefined index: argv in ......
is there some option i need to turn on in my PHP config to have access to th is variable?

Kendall
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Is 'argv' a server variable?
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post by kendall »

Everah wrote:Is 'argv' a server variable?
http://www.php.net/manual/en/reserved.variables.php

well...they say it may/ may not be available....i was hoping i knew how to get it :? :?:

anyone ever used this?

Kendall
Robert Plank
Forum Contributor
Posts: 110
Joined: Sun Dec 26, 2004 9:04 pm
Contact:

Post by Robert Plank »

I think argv is for arguments from the command-line when you call PHP directly through the CLI... if you just want "parameters passed via the url" why aren't you using $_GET?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Reading the CGI 1.1 Specification, there is no mention of the argv variable. When reading the PHP definition of the 'argv' variable, this stands out...
The PHP Manual on Predefined Variables wrote:Array of arguments passed to the script. When the script is run on the command line, this gives C-style access to the command line parameters. When called via the GET method, this will contain the query string.
Robert Plank
Forum Contributor
Posts: 110
Joined: Sun Dec 26, 2004 9:04 pm
Contact:

Post by Robert Plank »

I used to sometimes use argv a long while ago but it broke for me around late 2004 / early 2005.
Post Reply