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
Yes, you should have the DOCTYPE declaration, since what you send the browser is HTML, not PHP.
DOCTYPE
The declaration tells the browser that you are using HTML 5 and tells it how to render it.