This site utilizes JavaScript to function correctly. Looks like it's disabled on your browser. Please enable it for your best experience.

For instructions on enabling JavaScript, click here

Skip to main content

Just Host Web Hosting Help

Executing PHP code within an HTML document

Problem:

Executing php code within a HTML document

Warning: Deprecated
This article is inaccurate or out of date and should not be used.

Solution:

Deprecated Executing php code within a HTML document is easy. Simply add this line to your main .htaccess file:

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

Then, you can insert code into your .html pages like this:

Code:
  <?php
                echo "hello world"
              ?>

Knowledgebase Article 157,459 views bookmark tags: addhandler addtype handler mime parse php sethandler


Was this resource helpful?

Did this resolve your issue?


Please add any other comments or suggestions about this content:





Recommended Help Content

This article will explain how to add a PHP handler to your .htaccess files. This is useful if you want to customize the version of PHP that runs your PHP files.
Knowledgebase Article 219,073 views tags: htaccess php

If suddenly when you go to your page, you get nothing on the page. You can still get HTML to display, just not PHP. To serve HTML pages to browsers, we don't associate the Apache processes with your 2
Knowledgebase Article 111,426 views tags: blank page php

The redirection of www.yourdomain.com/default.html or index.html to http://www.yourdomain.com/index.php?act=whatever redirects it to http://www.yourdomain.com/index.php%3fact=whatever In other words,
Knowledgebase Article 832,540 views tags: htaccess messing mod php redirect redirects rewrite variable variables

Related Help Content

How do I redirect users to another page using PHP?
Knowledgebase Article 432,740 views tags: header location php redirect redirects

This article will explain how to create MIME types.
Knowledgebase Article 46,766 views tags: create custom extensions files mime types

How to Set different character sets with PHP and HTML to display correctly.
Knowledgebase Article 108,126 views tags: arabic character chinese collation japanese language languages mysql php phpmyadmin sets

Instructions to set different character sets in HTML. Note: Not all character sets will be correctly rendered with this encoding format, but most will. You can find specific information about which ch
Knowledgebase Article 110,395 views tags: arabic change character chinese html japanese language languages sets

How can I adjust the php settings specifically for an Addon Domain?
Knowledgebase Article 169,741 views tags: domain php

How to customize your html or php error pages.
Knowledgebase Article 104,880 views tags: errors php

This article explains how to enable FastCGI for PHP applications.
Knowledgebase Article 102,605 views tags: fastcgi php

I need an EPP authorization code to transfer my domain to another registrar.
Knowledgebase Article 245,959 views tags: auth authorization code domain epp transfer

** Google ad credits are only available to customers in the United States, Canada, and the United Kingdom at this time.

¹ VAT (Value Added Tax) is not included in our advertised price and will be charged separately and itemized on invoices and billing information. Standard VAT rates based on EU Member State regulations may apply. Learn more.