Page 1 of 1

Getting argv[1] using php-cgi

Posted: Thu Mar 15, 2007 10:49 am
by topaz
From the command prompt in windows, if I run ‘php.exe test.php arg1’ from the CLI I can retrieve arg1 using $argv[1] inside of test.php

However, if I run ‘php-cgi.exe test.php arg1’ I get the error ‘Undefined index: argv’

What is the proper way to retrieve args from inside your php code using php-cgi.exe?

Posted: Thu Mar 15, 2007 11:01 am
by volka
Why do you use php-cgi.exe when you want the functionality of cli?

Posted: Thu Mar 15, 2007 11:47 am
by stereofrog
Have you tried $_SERVER['argv'] ?