PHP Code Does Not Work in HTML Files

This happens when the file types processed by PHP are redefined in the .htaccess file. The following directives are used for this:
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
However, this configuration only applies if PHP on your website runs in mod_php mode. Nowadays this is rare; mostly the php_fastcgi mode is used.
Solution
If your website downloads PHP files instead of opening the page, or PHP code does not work in HTML, do the following:
- Go to the hosting panel, section: Websites & Domains --> click your domain --> Apache & nginx Settings
- In the "Additional directives for HTTP" field, add the code shown below:
SetHandler fcgid-script
FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .html
Options +ExecCGI
allow from all

If you have any questions, contact the Ukrhost specialists from any city in Ukraine.