LinkShare  Referral  Program

New

Advertise ad Here
learn more
            PHP > how to run PHP on HTML Pages
Useful

Links


Free technical Tutorials At techtutorials.net



Link Exchange at iWEBTOOL.com

 



The PHP Resource Index


iBuyOfficesupply.com Inc. There is not Comments for this Article,Be the first one
Ask any relevant question in the Comments or leave your valuable feed-back

printer  Print version of this article

star  Add it to your favourite!

mail email this page to a frend
LinkShare  Referral  Program
Added on   2008-01-13
Clicks     10003
Rating:   3.88   out of 5 from   53   raters      
         rate this page   
 Not rated yet.Be the first one to vote!!

How to run PHP in any web Pages

  • How to use PHP include function
  • How to use PHP with HTML/HTM pages


  • How to use PHP include with .HTML .HTM extension


    

    In this tutorial I recommended to use .php extension so far because it won't work other ways .But if your have a  website with static pages ,this can be a problem ,you'd have to rename all your pages and also you don't want to loose the search engine ranking of your html pages, so if you want to add PHP functionality and dynamicity to it,read the following article and the PHP code will work on HTML pages and you won't have tons of broken links.But, careful. Thou, from the moment you do this configuration ,everything between <?php and ?> will be considered as PHP by the parser.

    On Apache Servers

    To force Apache to run PHP code on .HTML/HTM pages is very simple.If you have your website hosted on a remote webserver,download the .htaccess file from the root web folder and add the following rows:
    AddType application/x-httd-php .html
    AddType application/x-httd-php .htm
    Then upload the .htaccess back to the server.

    If you have Apache running on your computer,open the httpd.conf  file with notepad  ,find the Add Type section and add the following rows
    AddType application/x-httd-php .html
    AddType application/x-httd-php .htm
    Then save the file and close it.

    On IIS Web Servers

      IIS properties



      Configuration window





      Add dialog box





      Configuration Window



    From now on anything in your HTML/HTM pages between the tags <? ?> will be recognized by  IIS  as PHP code .To check it,try to apply to the include example at the beginning of this article.Do all exactly the same but change the extension of TestInclude2.php in .html.

  • How to use PHP include function



  • Comments

    Post your comment here or ask any question that is rilevant on what is shown in this page.
    Thank you for visiting this website

    There is not comments for this page yet.Be the first to post one   add a comment

    i