Wednesday, August 18, 2010

How to Enable PHP Inside HTML Pages

php code can be embedded within html pages within the tags:
<?php echo "my php code"; ?>

However, and depending on the server that you are using, this must be enabled. On apache2, you can edit the .htaccess file to include:
AddType application/x-httpd-php .htm .html

I added this line to the .htaccess on my website's root directory.

Voila!

Cite as:
Saad, T. "How to Enable PHP Inside HTML Pages". Weblog entry from Please Make A Note. http://pleasemakeanote.blogspot.com/2010/08/how-to-enable-php-inside-html-pages.html

6 comments:

  1. Great stuff for an begineer. Thanks.

    ReplyDelete
  2. Iam too an beginner in PHP. This is the first topic we will be learning in php. PHP is a scripting language. Scripting is using of predefined functions.

    ReplyDelete
  3. Hellow sir thanks for this useful information....
    http://www.engineersinstitute.com/

    ReplyDelete
  4. although websites we backlink to below are considerably not related to ours, we feel they are actually worth a go through, so have a look

    ReplyDelete