Bluehost Web Hosting Help

Executing PHP code within an HTML document


Executing php code within a HTML document


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:

            echo "hello world"

Knowledgebase Article 97,755 views bookmark tags: mime php (updated 1870 days ago)

Was this resource helpful?

Did this resolve your issue?

Please add any other comments or suggestions about this content:

Recommended Help Content

HTML Coding - Scope of Support

I need help with my HTML code. Will Bluehost help me? (updated 2191 days ago)

MIME Types Setup Instructions

What are MIME Types? How do I create custom MIME Types? (updated 2156 days ago)

PHP pages do not display

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 (updated 2203 days ago)

Related Help Content

Redirects that do not work due to PHP variables

The redirection of or index.html to redirects it to In other words, (updated 613 days ago)

Character sets in PHP

How to Set different character sets with PHP and HTML to display correctly. (updated 2155 days ago)

Create Custom MIME Types

This article will explain how to create MIME types. (updated 160 days ago)

Character sets in HTML

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 (updated 1235 days ago)

Manually editing your error pages

How to customize your html or php error pages. (updated 1066 days ago)

EPP (Auth) Code

I need an EPP authorization code to transfer my domain to another registrar. (updated 1172 days ago)

PHP Config

PHP vs PHP single php.ini vs PHP with FastCGI (updated 1236 days ago)

Adding Handlers to change your PHP Version

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. (updated 32 days ago)