Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Firefox 3.6.8 won't open local php files. It opens the save as text dialog box instead.

  • 10 个回答
  • 170 人有此问题
  • 3 次查看
  • 最后回复者为 dumili

more options

When I try to open a local php file on my MAC hard drive with FF 3.6.8, the save file dialog box opens instead. It says: You have chosen to open index.php which is a TextEdit.app Document. I do not have this problem with Firefox 3.5.11.

I have tried: opening the file directly from Firefox as well as double clicking the file (which is the most common way).

I have also tried changing the file "open with" preference to "open with Firefox." That did not work either.

Any help on this would be appreciated. I'm on a MAC OS 10.5.8

Thnx, Nick

When I try to open a local php file on my MAC hard drive with FF 3.6.8, the save file dialog box opens instead. It says: You have chosen to open index.php which is a TextEdit.app Document. I do not have this problem with Firefox 3.5.11. I have tried: opening the file directly from Firefox as well as double clicking the file (which is the most common way). I have also tried changing the file "open with" preference to "open with Firefox." That did not work either. Any help on this would be appreciated. I'm on a MAC OS 10.5.8 Thnx, Nick

所有回复 (10)

more options

Only thing that seems to work is clearing the cache.

On OSX try Firefox > Preferences > Advanced > Network > Clear Now

more options

Do you have a local server that sends the php with the wrong MIME type?
A server needs to process php files and send them as text/html if it aren't already processed php files that you have saved from a website.

See also:
"File handling in Firefox 3 and SeaMonkey 2" and "Reset Download Actions":

http://kb.mozillazine.org/File_types_and_download_actions
more options

Hi, Thnx for the reply. I tried clearing the cache - that did not change anything.

BTW: I tried MAC Safri, Chrome, Opera, and Camino

Opera and Camino open the page (rendering the HTML on the page), as expected. (Of course just displaying the php script part as text - as expected.)

Safari displays the page code in the browser window. Chrome downloads the page as a text file.

It seems odd that Firefox (and Safari) won't at least render the HTML part of a file with the .php extension.

Maybe there is a good reason they are doing this, but it sure is inconvenient when testing a local php page in the browser for proper html layout.

Nick

more options

You have to delete mimeTypes.rdf. You can find it here (Windows XP): C:\Documents and Settings\Username\Aplication Data\Mozilla\Firefox\Profiles\xxxxxxxx.default.

more options

run regedit.exe change:

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.php\Content Type to = "text/html"

or remove this key

由durnelis于修改

more options

On Ububtu with latest Firefox (6.0), this is what I did to open .php and .phtml files directly in the browser. Remember these files are on local host and not served by a web server (in which case the header changes):

  1. Change to your home dir: $ cd <enter>
  2. Find where the mime types file is: $ find -name "mimeTypes.rdf"
  3. Backup the found file: cp -p ./firefox/<rand str>.default/mimeTypes.rdf /tmp/
  4. Edit the rdf file: vi ./firefox/<rand str>.default/mimeTypes.rdf
  5. With in 'vi', search for string: asc. You are looking for ascii or plain text file configuration. You should see the following in the rdf file: <NC:fileExtensions>asc</NC:fileExtensions>
  6. Either after the above entry or after all the existing plain text extensions, add your own. This is what I have added: <NC:fileExtensions>phtml</NC:fileExtensions> <NC:fileExtensions>php</NC:fileExtensions>
  7. Save the rdf file. Restart the browser and open your .phtml and .php files directly in the browser as plain text files.
  8. If for some reason, you have trouble, restore your backed up rdf file and restart your browser again to go back to where you began.
more options

[ FIXED! ]

Hi guys, this has NOTHING to do with Mime-Types, either server or local, the problem is the new Modal Boxes that were introduced. To fix:

  1. in the address bar type about:config
  2. in the filter text-box type in: prompts.tab_modal.enabled
  3. right-click on prompts.tab_modal.enabled and select "Toggle" so that the value reads "False"
  4. Restart FireFox and PHP now loads how it used to!

Enjoy!!

more options

@chad: In firefox 3.6.23 on WinXP that filter value comes up empty.

I recently experienced this change in FF, too, which is a very inconvenient for people who do a lot of design as well as coding.

I have many notes pages which are handy to view locally. I made many of them php even when they didn't have any php code yet because FF supported viewing PHP as HTML.

Now, I either have to change the extension or view them on the web only (as I prefer not to install php just to serve them on my machine).

由williamc于修改

more options

Hi, deleting mimeType.rdf worked in one case, but not afterwards when the same problem came up anew. Then, change in register was needed, see on this page editing of the register key.

由dumili于修改

more options

Registry key worked, but it was in other key: HKEY_CLASSES_ROOT\.php Change ContentType from "application/x-php" to "text/html"