The script should be run behind a web server. I'm assuming your loading the file in a web browser as a file with the address bar showing 'file:///....file.php' instead of 'http://...file.php'.
You should install a apache/php stack on your pc if you don't have one. The easiest way to do so is...