I am using ubuntu 11.04 with an apache-mysql server (I think that is called LAMP) on a firefox web browser. If I put a php file in my document root, and then type http://localhost/myfile.php, it runs fine. But if I simply click it, it opens up firefox and prompts me to save or download the file. If I put it, say, on my desktop, and doubleclick it, it does the save or download thing. Why is this, and can I configure it so that I can just click and display like a normal html file would?
Share
A PHP file needs to be interpreted server-side before it reaches the browser. If you just open it using
file:///foo/bar/myfile.php, Firefox won’t know what to do with it, because Firefox doesn’t interpret PHP. Conversely, how would Firefox know that/foo/bar/myfile.phpshould be opened using the completely unrelated addresshttp://localhost/myfile.php?Bottom line: it just doesn’t work that way.