PHP is a serverside scripting language which means that the host (local and/or remote) must have PHP scripting enabled.
The document (web page) must have a PHP extension for the server to recognise the script.
Within the document, the script must start with '<?php' and end with '?>'.
This tutorial may help to understand.