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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: anrdaemon at yandex dot ru
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 09:01:38 2025 UTC