I have a php file with my website content in it. The file needs to be .php because i get some variables first and then use it later in the website content. Like this example
The same rules for HTML apply equally, whether they're plain HTML files, or HTML files with embedded PHP. YOu need a doctype in every circumstance you'd need one in plain HTML.
By the way, there's whitespace between the end of the first block oh PHP code and the doctype. I seem to remember that whitespace before the doctype can be problematic (though that might only apply to XHTML)