{"id":1600,"date":"2019-02-08T10:35:53","date_gmt":"2019-02-08T10:35:53","guid":{"rendered":"https:\/\/blog.hostinger.io\/support\/2019\/02\/08\/1583190-how-to-parse-php-in-html-files\/"},"modified":"2026-03-16T12:12:18","modified_gmt":"2026-03-16T12:12:18","slug":"1583190-how-to-parse-php-in-html-files","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/1583190-how-to-parse-php-in-html-files\/","title":{"rendered":"How to Parse PHP in HTML Files"},"content":{"rendered":"<p class=\"no-margin\">PHP is a powerful scripting language used for creating dynamic web applications. Typically, PHP files have a <b>.php<\/b> extension, allowing the server to recognize and process them accordingly. However, there are situations where you might want to embed PHP code directly within an HTML file, such as for integrating dynamic content or executing specific functions within the HTML structure. <\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">To parse PHP code in HTML files, inform the server that the <b>.html<\/b> and <b>.htm<\/b> files contain PHP code by following these steps:<\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_2f87b36c69\">Step 1 &ndash; Preparations<\/h2><p class=\"no-margin\">Create a <b>backup<\/b> of your .htaccess file before proceeding. An easy way of doing it is by copying the file and renaming it, for example, to <b>.htacces-backup<\/b> using the <b><a href=\"\/support\/4548688-basic-actions-in-the-file-manager\" target=\"_blank\" class=\"intercom-content-link\">File Manager<\/a><\/b>.<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">If the file is not present in the <b>public_html<\/b> folder of your website, <b><a href=\"\/support\/1583307-how-to-create-an-htaccess-file\" target=\"_blank\" class=\"intercom-content-link\">create it<\/a><\/b>.<\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_05a7be0984\">Step 2 &ndash; Edit the .htaccess File<\/h2><p class=\"no-margin\">Next, open the <b>.htaccess<\/b> file using the <b><a href=\"\/support\/7949267-how-to-use-the-file-editor-at-hostinger\" target=\"_blank\" class=\"intercom-content-link\">File Editor<\/a><\/b> and add the following directive to the <b>.htaccess<\/b> file:<\/p><pre><code>AddHandler application\/x-httpd-lsphp .htm .html<\/code><\/pre><p class=\"no-margin\">After saving this change, you can now embed PHP code directly within your HTML markup.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Parsing PHP in HTML files<\/p>\n","protected":false},"author":581,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"include_on_kodee":true,"footnotes":""},"categories":[230],"tags":[],"class_list":["post-1600","post","type-post","status-publish","format-standard","hentry","category-php-advanced"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/support\/1583190-how-to-parse-php-in-html-files\/","default":1},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/support\/1583190-comment-analyser-php-dans-les-fichiers-html-chez-hostinger\/","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/support\/1583190-bagaimana-caranya-membuat-parsing-php-di-file-html-di-hostinger\/","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/br\/support\/1583190-como-executar-php-em-arquivos-html-hostinger\/","default":0},{"locale":"uk-UA","link":"https:\/\/www.hostinger.com\/ua\/support\/1583190---php--html--hostinger\/","default":0}],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1600","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/comments?post=1600"}],"version-history":[{"count":0,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1600\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=1600"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=1600"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=1600"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}