you cannot "open" a php file in a browser, you have to "run" it. netbeans will run files (note they don't get compiled in the way things like java get compiled)
if you are testing on your local machine, you need an apache installation which runs php (xampp for example).
if you are using xampp:
open the htdocs folder inside the xampp folder.
create a new folder for your webapp.
put your php file in that folder.
in your web browser, NAVIGATE to your php page (in the address bar, type in the IP address of the machine running xampp, or localhost, or however you have it configured, mylocalhostip/mywebapp/myphpfile.php for example.
then it should work fine