PHP在本地服务器上运行PHP和HTML文件时不执行更正(Mac Snow Leopard)

I am learning how to code in PHP and MySQL and I am running into trouble with my HTML calling up PHP. The code looks like:

<form method="post" action="report.php">

When I ran the PHP and HTML on web server (hosted by GoDaddy), the code worked fine.

However, now I am running on a local server (using Apache and MySQL on my Mac Snow Leopard) and I am getting errors. When PHP gets called, a dialogue window pops up saying that "I have chosen to open report.php" and asking if I want to open it with a text editor or save it. I am using FireFox 3 and it's the same dialogue window that appears when opening up a file.

Do I need to do something in particular when I am using my local server? Do I need to save my files in a particular location?

I've spent a long time trying to fix this so any help would be greatly appreciated!

Have you opened /etc/apache2/httpd.conf and enabled the php5 module?

Should be able to uncomment this line:

LoadModule php5_module        libexec/apache2/libphp5.so

This sounds like a server configuration issue. Apache doesn't know what to do with PHP files and is giving them back to the browser instead of executing them. This generally means PHP is not installed properly. Check in your httpd.conf file that the correct AddType directives have been added so that Apache knows about the PHP interpreter.

you need to open the file via the server not a directory so in your browser something like http://localhost/file.php