Embedding PHP In HTML Pages

Normally, when you include PHP code on a page, the page must have the .php extension instead of .html. Without the .php extension, the PHP interpreter won't parse the page and the PHP code won't be interpreted.

If your site uses an Apache server, you can have PHP code on a page with an .html extension if you use an Apache handler. If your server has cPanel, select "Apache Handlers". Under Extension(s) add .html and under Handler add application/x-httpd-php. Click the Add button and you're done. If you don't have cPanel, add the following line to an .htaccess file:

AddHandler application/x-httpd-php .html

One word of caution: if you have a lot of HTML files on your server that don't contain PHP code, the files will still be parsed, and it may slow things down.