ابحث في الدعم

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

PHP file from my computer doesn't work

more options

I'm web developer and I'm making PHP based HTML pages. Then I try to open them with Firefox, Opera or Chrome, all browsers try to download the file. I'd just like to see the file in the browser. Is this possible?

I'm web developer and I'm making PHP based HTML pages. Then I try to open them with Firefox, Opera or Chrome, all browsers try to download the file. I'd just like to see the file in the browser. Is this possible?

All Replies (4)

more options

You are opening pages directly from the hard drive, i.e., file://pages/test.php? Generally speaking, you need a pre-processor to turn the PHP page into HTML. Usually this runs on a web server, either a remote server or a web server you run off your own system. I am not familiar with your OS; it might already have a web server installed that can do this.

more options

Yes. I succeeded to open the page in Opera, but it doesn't still work in Firefox or Chrome. However, I got a web server, so I can make my trials with that. Thank's for help!

more options

The handsome and helpful jscher2000 is asking a good first question. Are you opening files that are stored on a web server with PHP installed & turned on (whether that is your own computer or a remote computer)? Or are you opening files stored on a computer without PHP installed & turned on?

IF you're opening files that are on a server from which you can normally open them and see them displayed as expected, read on ...

"I'm web developer and I'm making PHP based HTML pages." Me, too :) ! Fairly recently, the same thing happened to me and my website's users. It turns out that the web server's administrator had made some changes to the server the night before, which caused PHP files (files with the extension ".php") to be offered for download instead of being rendered as web pages to the browser. As soon as I told him of the problem, fortunately, this guy knew exactly what had happened and how to fix it.

Of course, I can't promise anything regarding your server or its administrator(s), and I can't know if your problems have the same cause ... but it is worth asking your server's admin(s) about the problem.

Good Luck! (Or, "Onnea!" if I've got that right :) .)

more options

Nice Finnish! ;) However, as I said, I'm opening the file from my own computer. I've got a server with PHP support now, so I use it. On my computer, it doesn't still work though I've installed Linux Xampp.