Just Host Web Hosting Help

Executing PHP code within an HTML document

Problem:

Executing php code within a HTML document

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 115,403 views bookmark tags: mime php


Was this resource helpful?

Did this resolve your issue?


Please add any other comments or suggestions about this content:





Recommended Help Content

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 84,110 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 774,038 views tags: htaccess messing mod php redirect redirects rewrite variable variables

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

Related Help Content

How to Set different character sets with PHP and HTML to display correctly.
Knowledgebase Article 84,569 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 90,956 views tags: arabic change character chinese html japanese language languages sets

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

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 86,820 views tags: htaccess php

PHP vs PHP single php.ini vs PHP with FastCGI
Knowledgebase Article 222,374 views tags: configuration php server

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

How do I change the PHP environment for my site with php.ini?
Knowledgebase Article 551,109 views tags: configuration php server

Getting Started Wizard How to obtain a Transfer Authorization ( EPP ) Code If you want to transfer your .com, .net, .biz, .us, .org or .info domain, you will need to contact your current registrar an
Getting Started Article 442,628 views tags: authorization code domain domains top