php.net |  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
Votes:1
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
Description:
------------
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:
---------------
<?php
echo "\nArguments:$argc\n";
?>

Expected result:
----------------
Arguments:4

Actual result:
--------------
Arguments:1

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-28 09:40 UTC] rquadling@php.net
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] svn@php.net
Automatic comment from SVN on behalf of rquadling
Revision: http://svn.php.net/viewvc/?view=revision&revision=286450
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