HostArmada Web Hosting Knowledge Base

Knowledge is power! Use that power and achieve total and unconditional control over the Web Hosting Services!

How can I execute PHP code inside HTML files?

Depending on your website or what you are used to when writing code, you may want to include PHP inside your HTML files. If this is what you need, you can absolutely achieve it by adding a snippet of code inside your .htaccess file:

<FilesMatch "\.(php4|php5|php3|php2|php|phtml|html|htm)$"> 
SetHandler application/x-lsphp<version>

However, in the place of <version>, please write down the PHP version - for example 7.4:

<FilesMatch "\.(php4|php5|php3|php2|php|phtml|html|htm)$">
SetHandler application/x-lsphp74

Please do not forget to insert your PHP opening (<?php) and closing (?>) tags inside the HTML file prior to typing your PHP code as well so that the web server knows that it needs to compile and execute php code!

You can use the following PHP version on HostArmada: 56, 70, 71, 72, 73, and 74. If you do not feel comfortable making changes to your .htaccess file, then do not worry, as our technical support team is 24/7 available at your disposal to assist you whenever needed. You can contact them through the ticket system in your Client Area.

Was this article useful and on point?

Find out more about HostArmada entire range of optimized Web Hosting Services and take action today on improving your website Loading Speed, Security, and overall Stability!