the file extension .html
is not parsed by the PHP interpreter. You can do the simple thing, and change the file extension to .php
or make PHP parse .html
files.
Go to the PHP ini file. At the end you will find this:
AddType application/x-httpd-php .php
change it to:
AddType application/x-httpd-php .php .html .htm
and a restart will activate it. If you use Apache it would be this command:
httpd -k restart
This is quite straightforward. Personally I prefer to keep the .html
and .htm
extension and hide the fact that I am using PHP. Why give away more information than needed? (not that obfuscation is a good way to implement security, but it cannot hurt). I also don't need to make an artificial distinction between pure html files and php file.
The downside is that all html files will go through the PHP parser, and this will be a tiny extra load on your server.