MozillaZine

Associate .php files with firefox, Windows 7 (FINALLY Solved

User Help for Mozilla Firefox
slickrcbd
 
Posts: 324
Joined: September 1st, 2010, 1:57 am

Post Posted November 27th, 2016, 4:44 pm

This might be more of a Windows problem, but I got no help on the Microsoft forums here.

I just double-clicked on a story I had saved that was in .php format. Oddly I got prompted to choose what program I wanted to use to open the file.

No problem, I'll just choose Firefox and tell it to always use Firefox.

Except that navigating to C:\Program Files\Mozilla Firefox\ and selecting "firefox.exe" does not cause firefox.exe to appear in the list of programs.

Furthermore, subsequently clicking "browse" again causes it to go back to C:\program files

Finally, hitting "OK" after navigating to Firefox and ignoring the lack of it appearing causes some random program to be selected instead and setting it as default.

What gives and how do I fix it?

I get the same result with "Associate a file type or protocol with a specific program."

I have to drag the .php file into an active Firefox window, or go through Firefox's "open file..." , or navigate in the browser to
file:///d:/path/to/file/
and click on the file on the list.

How do I fix the association so I can double-click on a .php file from an Explorer window or from AgentRansack?

P.S. If it would help, I can upload some pictures, but I already attached them to the virtually identical post I made in the Microsoft Forums.
Last edited by slickrcbd on September 21st, 2017, 4:42 pm, edited 1 time in total.

morat
 
Posts: 2363
Joined: February 3rd, 2009, 6:29 pm

Post Posted November 27th, 2016, 5:09 pm

Here is how I associate a file type with a program.

Control Panel > Programs > Default Programs
Default Programs - Associate a file type or protocol with a program (Set Associations)

There is no .php extension in the table.

<command prompt>

type nul > temp.php
C:\Windows\explorer.exe /select,temp.php

del temp.php

</command prompt>

* right click temp.php
* click Properties
* click Change
* click Browse
* paste C:\Program Files\Mozilla Firefox\firefox.exe

pirst
 
Posts: 191
Joined: January 2nd, 2008, 7:07 am

Post Posted November 27th, 2016, 7:48 pm

php files are server side files - so there is no point associating them with firefox if you're just end user. If you know something about programming you better try opening it in notepad. The was some sort of mistake on the server that browser didn't recognize it as file for rendering, but for downloading.

slickrcbd
 
Posts: 324
Joined: September 1st, 2010, 1:57 am

Post Posted November 27th, 2016, 8:19 pm

morat wrote:Here is how I associate a file type with a program.

Control Panel > Programs > Default Programs
Default Programs - Associate a file type or protocol with a program (Set Associations)

There is no .php extension in the table.

<command prompt>

type nul > temp.php
C:\Windows\explorer.exe /select,temp.php

del temp.php

</command prompt>

* right click temp.php
* click Properties
* click Change
* click Browse
* paste C:\Program Files\Mozilla Firefox\firefox.exe

I'm confused. Wouldn't "del temp.php" delete the file, and thus I'd be unable to right-click on it in the next step?

That said, the "Associate a file type or protocol with a program" allows me to associate Chrome or IE with the file, but not Firefox.

It doesn't matter if it initiate it via right clicking and choosing "open with", right-clicking and choosing "properties" then clicking on "change", or going to Default Programs, clicking on "associate a file type or protocol with a program", finding .php in the list, and clicking on "change program", the browse button does not work for Firefox.

The system is a dual-boot 64-bit Windows Vista Home Premium/Windows 7 Professional. There is an old (and probably still 32-bit as I have no memory of upgrading the Vista side since I rarely use it these days now that everybody I used to support has Windows 7, 8 or 10, the reason I made it a dual boot instead of clean install doesn't really exist anymore) copy of Firefox on what is recognized as the D drive for Vista at D:\program files (x86)\mozilla firefox\firefox.exe, and the copy used by Windows 7 with 64-bit Firefox is at the C:\program files\mozilla firefox\firefox.exe
When I boot Vista, the C and D drives get reversed. That took me by surprise since making Windows 98[SE]/XP dual-boots did not behave that way and I did not remember XP/Vista dual-boots doing it either, but I only remember setting that latter one up once, the rest mostly had me downgrading to XP because of problems with Vista.


ImageFirefoxprogram by slickrcbd, on Flickr

Imagenofirefox3 by slickrcbd, on Flickr


https://flic.kr/s/aHskPtDEyw

slickrcbd
 
Posts: 324
Joined: September 1st, 2010, 1:57 am

Post Posted November 27th, 2016, 8:20 pm

Sorry, I recycled images fromthe post on the Microsoft forum made last Spring. Firefox is now dated 11/19/2016. Just in case you want to call me on an outdated version that does not match what is posted at the bottom.

makaiguy

User avatar
 
Posts: 16469
Joined: November 18th, 2002, 6:44 pm
Location: Somewhere in SE USA

Post Posted November 27th, 2016, 8:58 pm

Php files must be run on a server. They output html code that then can be read by a browser, such as Firefox, but I've not heard of a browser that can natively run a php file.
Doug Wilson, "The Makai Guy"
Win10 (64bit): FF 52.4.0 ESR (64bit), TB 52.3.0 (32bit)║ Android 7.0/6.0.2: FF 56.0, No TB for Android available, dammit!
What a fool believes he sees, no wise man has the power to reason away - Doobie Brothers

slickrcbd
 
Posts: 324
Joined: September 1st, 2010, 1:57 am

Post Posted November 27th, 2016, 10:15 pm

Chrome opens it just fine. IE refuses to mess with it, just keeps asking if I want to open or save the file.
Firefox opens it just fine if I drag it onto an open Firefox window, or any other method of opening a file from within.
On my old XP machine, I can double-click on the file (it is actually stored on my old Windows 98SE/XP dual-boot machine that 15 years ago was my primary and best computer, but is now used as a file/print server), but copying it to the local hard drive has no effect on this problem. I checked) without issue and Firefox opens it just fine.
I know I used to be able to do the same with Firefox 2 on the 98SE side of the dual-boot, but I haven't checked in a LONG time.

morat
 
Posts: 2363
Joined: February 3rd, 2009, 6:29 pm

Post Posted November 27th, 2016, 11:06 pm

@pirst
@makaiguy

It renders for me in Firefox and Chrome. Internet Explorer opens the file as text.

e.g.

ren Calendar.htm Calendar.php

FirefoxPortable.exe C:\Calendar.php
chrome.exe C:\Calendar.php
iexplore.exe C:\Calendar.php

@slickrcbd

I don't know. Are you using the correct path? Any non-ASCII characters in the path?

Unicode code converter
http://r12a.github.io/apps/conversion/

Brummelchen
 
Posts: 2276
Joined: March 19th, 2005, 10:51 am

Post Posted November 28th, 2016, 9:30 am

What can PHP do?

Anything. PHP is mainly focused on server-side scripting, so you can do anything any other CGI program can do, such as collect form data, generate dynamic page content, or send and receive cookies. But PHP can do much more.

http://php.net/manual/en/intro-whatcando.php

from a simple view php-files can contain pure html code - which is pretty pointless, the it should be named htm(l). or php code - or both. anyhow its puurpose is not to run on a browser than a server.

if you want it run in a browser rename it to htm(l) and see what you get.

slickrcbd
 
Posts: 324
Joined: September 1st, 2010, 1:57 am

Post Posted November 28th, 2016, 6:23 pm

morat wrote:@pirst
@slickrcbd

I don't know. Are you using the correct path? Any non-ASCII characters in the path?

Unicode code converter
http://r12a.github.io/apps/conversion/

A direct copy/paste from the explorer window where firefox.exe is located:
Code: Select all
C:\Program Files\Mozilla Firefox

It makes no sense that it refuses to run the program.
Oh, and i checked security permissions for the folder in question. The group "users" has three permissions: Read & Execute, List folder contents, and Read, CREATOR OWNER had none checked, but I checked the same as users and it had no effect. I can choose Chrome or Internet Explorer, but it refuses to add Firefox to the list.

morat
 
Posts: 2363
Joined: February 3rd, 2009, 6:29 pm

Post Posted November 29th, 2016, 12:19 pm

Try to associate the .php file type with a .vbs script.

Code: Select all
Option Explicit
Dim strPath
strPath = """C:\Program Files\Mozilla Firefox\firefox.exe"""
Dim objShell
Set objShell = CreateObject("WScript.Shell")
If WScript.Arguments.Count = 0 Then
  objShell.Run strPath
Else
  objShell.Run strPath & " " & chr(34) & WScript.Arguments(0) & chr(34)
End If
Set objShell = Nothing

The script opens a file in Firefox.

VBScript
http://en.wikipedia.org/wiki/VBScript

slickrcbd
 
Posts: 324
Joined: September 1st, 2010, 1:57 am

Post Posted September 21st, 2017, 4:42 pm


therube

User avatar
 
Posts: 17539
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Post Posted September 22nd, 2017, 10:33 am

(Same result here as with the OP. I was able to "manually" set things up [but not 100%] using Nirsoft's FileTypesMan.
Basically I copied what was there for .html to .php. And with that, it reports some sort of "null" error, though the .php page does open as wanted.)
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball CopyURL+ FetchTextURL FlashGot NoScript

slickrcbd
 
Posts: 324
Joined: September 1st, 2010, 1:57 am

Post Posted September 22nd, 2017, 8:00 pm

I tried FileTypesMan but for some reason it wouldn't work, probably because FileTypesMan requires elevation, and then it sets the HKCU for the admin account, not the standard account.
About the only way I can get FileTypesMan to work right for my standard account is to temporarily change it to an admin account, run the program and make the changes, then change it back to a standard account.
Oh, and I had to twice go back and correct myself when I typed "limited account" instead of "standard account". I hate it when Microsoft changes the terminology for the exact same thing for no reason.

Return to Firefox Support


Who is online

Users browsing this forum: Google Adsense [Bot], Happy112 and 16 guests