You need to configure apache a little for telling how to execute php files.
For making php work with apache you first dump php suppose c:\php501\. Then add these lines to your apache httpd.conf file.
ScriptAlias /php/ "c:/php501/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php/php-cgi.exe"
First check your apache server is running correctly. If it is serving your html pages correctly then add the above three lines in your httpd.conf page. Restart your apache for taking your change work.
It will work if your php code path is "C:\php501\". Just change path in the first line. That's it.