As pointed out before, you can generally assume that your file needs to be named .php if the web server should parse it as php. Moreover, any part in that file that you want to be considered php code, should be inside php opening and closing tags, <?php and ?> respectively.
Fireater989;10935285 wrote:Ok, if I am using a php script in my html document
I believe you should rather think of it as "having a php script that creates html code". You can't call an html file and all of a sudden have it drop into php parsing. You can however call a php file that contains nothing but html, or partly html, or no html at all.
file.php
<?php
// file contains nothing but html code for doctype
require 'doctype.html';
// contains the exact same code
require 'doctype.php';
// And same thing again inside php tags
echo '<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
doctype.html and doctype.php
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
The above contains no <?php ?>, so even doctype.php will just send all its content without any parsing (beyond looking for <?php of course)