If you're running php from a page it generally needs to have a .php extension. You can use htaccess to run html pages as php, but I don't recommend this because its a needlessly complicated solution.
he answered your question here. For a shorter answer, if you are going to have php in any type of file, you have to use a .php extension or it will not execute the php code properly