Join the Mozilla’s Test Days event from 9–15 Jan to test the new Firefox address bar on Firefox Beta 135 and get a chance to win Mozilla swag vouchers! 🎁

Ce site disposera de fonctionnalités limitées pendant que nous effectuons des opérations de maintenance en vue de vous proposer un meilleur service. Si un article ne règle pas votre problème et que vous souhaitez poser une question, notre communauté d’assistance est prête à vous répondre via @FirefoxSupport sur Twitter, et /r/firefox sur Reddit.

Évitez les escroqueries à l’assistance. Nous ne vous demanderons jamais d’appeler ou d’envoyer un SMS à un numéro de téléphone ou de partager des informations personnelles. Veuillez signaler toute activité suspecte en utilisant l’option « Signaler un abus ».

En savoir plus

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

  • 10 réponses
  • 170 ont ce problème
  • 2 vues
  • Dernière réponse par dumili

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

Toutes les réponses (10)

Only thing that seems to work is clearing the cache.

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

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

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

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.

run regedit.exe change:

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

or remove this key

Modifié le par durnelis

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.

[ 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!!

@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).

Modifié le par williamc

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.

Modifié le par dumili

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