php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #66190 Instructions to register PHP as interpreter for associated scripts needs fix
Submitted: 2013-11-28 09:28 UTC Modified: 2016-06-18 11:25 UTC
From: anrdaemon at yandex dot ru Assigned: cmb (profile)
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
18 + 38 = ?
Subscribe to this entry?

 
 [2013-11-28 09:28 UTC] anrdaemon at yandex dot ru
Description:
------------
---
From manual page: http://www.php.net/install.windows.commandline
---
First, the order in which extension is registered is illogical, it only works because CMD does not check the presence of a file type, when adding an association.
But you MUST NOT rely on bugs.
You should create a file type first, then associate extensions with it.

Second, the suggested file type command prevent execution of a script with more than one argument (if at all functional - on my installation, it passing literal "%~2" to executing script). It must be changed to something like

ftype phpfile="C:\PHP5\php.exe" -f "%1" -- %*

to make it work with any number of arguments.
The "%~2" notation is CMD (and more specifically - CMD batch file) specific. When executing file type association, CMD is NOT used.

And third, I suggest using PHPScript for file type name, the same name used in PECL ActiveScript SAPI, to keep all associations in one place.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-18 11:25 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2016-06-18 11:25 UTC] cmb@php.net
When I do a `ftype /?` on Windows 10, I see the following example:

|    ASSOC .pl=PerlSkript
|    FTYPE PerlSkript=perl.exe %1 %*

So it's rather unlikely that this will break sometimes.

> The "%~2" notation is CMD (and more specifically - CMD batch
> file) specific.

In this case it is specific to ftype:

| %~ n is replaced with all of the remaining parameters, starting
| with the nth parameter, where n can be any number from 2 to 9.

So the usage appears to be correct.

> I suggest using PHPScript for file type name […]

It seems to me that PHPScript is obsolete, anyway.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Dec 03 20:01:23 2020 UTC