|  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
 [2013-11-28 09:28 UTC] anrdaemon at yandex dot ru
From manual page:
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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-18 11:25 UTC]
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2016-06-18 11:25 UTC]
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-2021 The PHP Group
All rights reserved.
Last updated: Mon Apr 12 05:01:24 2021 UTC