Chủ đề này đã được lưu trữ. Vui lòng hỏi một câu hỏi mới nếu bạn cần giúp đỡ.
Firefox 3.6.8 won't open local php files. It opens the save as text dialog box instead.
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
Tất cả các câu trả lời (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.
"File handling in Firefox 3 and SeaMonkey 2" and "Reset 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.
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
Được chỉnh sửa bởi durnelis vào
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):
- Change to your home dir: $ cd <enter>
- Find where the mime types file is: $ find -name "mimeTypes.rdf"
- Backup the found file: cp -p ./firefox/<rand str>.default/mimeTypes.rdf /tmp/
- Edit the rdf file: vi ./firefox/<rand str>.default/mimeTypes.rdf
- 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>
- 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>
- Save the rdf file. Restart the browser and open your .phtml and .php files directly in the browser as plain text files.
- 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:
- in the address bar type about:config
- in the filter text-box type in: prompts.tab_modal.enabled
- right-click on prompts.tab_modal.enabled and select "Toggle" so that the value reads "False"
- Restart FireFox and PHP now loads how it used to!
@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).
Được chỉnh sửa bởi williamc vào
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.
Được chỉnh sửa bởi dumili vào
Registry key worked, but it was in other key: HKEY_CLASSES_ROOT\.php Change ContentType from "application/x-php" to "text/html"