php只能从文档根目录下工作吗?

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?

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.php should be opened using the completely unrelated address http://localhost/myfile.php?

Bottom line: it just doesn't work that way.

PHP is a scripting language. The output you see from the address is the generated output of the executed PHP file. When you double click it you (correctly) get the file source.