K
K
kamelopardus2011-04-18 14:24:55
PHP
kamelopardus, 2011-04-18 14:24:55

Php under windows 7 in cli mode does not see arguments?

php 5.3 CLI
windows 7
I want to call php scripts just by calling the file name.
I do so

assoc .php=phpfile<br/>
ftype phpfile=&quot;c:\php\php.exe&quot; -f &quot;%1&quot; -- %~2<br/>

I try to call the script simply by the file name with the "helo" argument:
touch.php helo<br/>
Dump $argv:
array(1) {<br/>
 [0]=&gt;<br/>
 string(26) &quot;C:\hg\PHPScripts\touch.php&quot;<br/>
}<br/>

I call the script in full form:
c:\php\php.exe touch.php helo<br/>
Dump $argv:
array(2) {<br/>
 [0]=&gt;<br/>
 string(9) &quot;touch.php&quot;<br/>
 [1]=&gt;<br/>
 string(4) &quot;helo&quot;<br/>
}<br/>

That is, the arguments of the script call are visible to it only when it is called in full form, with the path to the interpreter. Is it curable?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
mark_ablov, 2011-04-18
@mark_ablov

look Process Explorer'om command line.
To do this, organize an infinite loop (30 seconds by default timeout :) ).

Y
yadeveloper, 2011-04-18
@yadeveloper

Try the following calls:
ini_get('register_argc_argv')
What do both results show?

K
kamelopardus, 2011-04-18
@kamelopardus

In both cases, it shows the value "1".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question