How to include PHP code in .htm/.html pages?

In order to include and execute PHP code in .htm/.html pages, you should set PHP as the default handler for these pages. You can easily do this by adding the following line to your .htaccess file:

AddHandler application/x-httpd-php56 .php .htm .html

Of course, you should make sure that your PHP code is correct and is placed between the opening <?php and the closing ?> PHP tags.

Note: You can modify the .htaccess file of your application via FTP, SSH or File Manager (in cPanel).