Mozilla 도움말 검색

고객 지원 사기를 피하세요. 저희는 여러분께 절대로 전화를 걸거나 문자를 보내거나 개인 정보를 공유하도록 요청하지 않습니다. "악용 사례 신고"옵션을 사용하여 의심스러운 활동을 신고해 주세요.

자세히 살펴보기

How do I open PHP documents locally?

more options

I'm trying to mirror a website, and firefox won't open (local) PHP files, even though they're identical to html files, only with a different suffix. It keeps asking me whether I want to "Save As..." or "Open with". When I try to open them with Firefox, I get the same dialog box...

Is there a way to get Firefox to recognize that it can open PHP files? Or at least treat them as html files? I went through the General Preferences, and even tried to change the default program to Firefox (And even tried "automatically" -- what a mistake!!), and kept getting the same dialog box. checking the code in my text editor showed that it was a simple html document. I would rather not have to go through all my files and change the suffix of every document from "php" to "html". I would think there's a better way. Is there a viewer plugin? or would it just be a fix in General Preferences -> Applications? On my Mac, it would show the document "type" beside the content type, ie. html/text.

(Ubuntu 18.04, Firefox 66.0.2)

I'm trying to mirror a website, and firefox won't open (local) PHP files, even though they're identical to html files, only with a different suffix. It keeps asking me whether I want to "Save As..." or "Open with". When I try to open them with Firefox, I get the same dialog box... Is there a way to get Firefox to recognize that it can open PHP files? Or at least treat them as html files? I went through the General Preferences, and even tried to change the default program to Firefox (And even tried "automatically" -- what a mistake!!), and kept getting the same dialog box. checking the code in my text editor showed that it was a simple html document. I would rather not have to go through all my files and change the suffix of every document from "php" to "html". I would think there's a better way. Is there a viewer plugin? or would it just be a fix in General Preferences -> Applications? On my Mac, it would show the document "type" beside the content type, ie. html/text. (Ubuntu 18.04, Firefox 66.0.2)

모든 댓글 (2)

more options

A PHP file is a server-side file, so generally you don't run those files locally. Firefox won't be able to run any of the PHP portion of your code.

That said, you should have no issues rendering the HTML portion in Firefox. Do you get the same issue if open the file within Firefox (pressing Command + O on your Mac keyboard)?

more options

How difficult would it be for you to set up a local Apache server on your Linux system so you can "serve" the files to your browser(s) on the loopback address http://localhost or http://127.0.0.1 (possibly adding a port number)?

Considering the various different restrictions on file:// addresses compared with http:// addresses, I think that would be a closer simulation of the actual server, too.