Ajenti Soulution
First of all, you need to configure your website via ajenti panel.
After you need to add htm extension to php-fpm.conf via ssh:
echo 'security.limit_extensions = .php .htm' >> /etc/php5/fpm/php-fpm.conf
And after you need to restart php-fpm:
service php5-fpm restart
Unfortunately, any changes in website settings via ajenti will rewrite php-fpm.conf file and you should be do last steps again.
For me it was not so important, because it was only necessary to test one engine and forgot about it, but for other people it’s can be very helpful, if you know how to prevent rewriting, tell in comments.
Common Soulution
If you are using apache, to run php code in htm file, you are simple add to .htaccess file:
AddType application/x-httpd-php .htm
If you are using nginx, you should add to configuration file something like:
location ~ \.htm { include fastcgi_params; fastcgi_pass unix:/var/run/php5-fpm.sock; }
And also add at the end of file /etc/php5/fpm/php-fpm.conf (or edit existing line)
security.limit_extensions = .php .htm
To do it’s in one command by ssh:
echo 'security.limit_extensions = .php .htm' >> /etc/php5/fpm/php-fpm.conf
And after you need to restart php-fpm:
service php5-fpm restart