|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42194 $argc/$argv[] won't work when .php extension is assigned to php.exe
Submitted: 2007-08-03 04:36 UTC Modified: 2009-07-28 16:45 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: backbone46 at gmail dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 6CVS-2007-08-03 (CVS) OS: Windows XP
Private report: No CVE-ID: None
 [2007-08-03 04:36 UTC] backbone46 at gmail dot com
I did a right-click->open-with->chose-program->browsed to php.exe
Checked the "Always use the selected program to open this kind of file" OK

So launched the following line in the console
C:\>script.php 1arg 2arg 3arg

Reproduce code:
echo "\nArguments:$argc\n";

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-28 09:40 UTC]
You have to tell windows that multiple parameters are allowed.

By associating in the way that you've done, you are only going to be 
getting the script name assigned to the interpreter.

The registry needs amending so that the handler's Run command looks more 
like ...

"C:\PHP5\PHP.EXE" "%1" %*

So, the script name is supplied in quotes (allowing script path or file 
name to have spaces) followed by all the other parameters.
 [2009-07-28 11:22 UTC]
Automatic comment from SVN on behalf of rquadling
Log: Bug#42194 - Document how to get command line script working like BAT files without the need to supply the executable or the extension and have all parameters supplied passed to the script.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Jan 27 05:01:24 2020 UTC