Maniacomputer Web Mail     Powered bydeskNow
     Learn More
    or     Register
Useful

Links


Free technical Tutorials At techtutorials.net



Link Exchange at iWEBTOOL.com

 


For the graphics you need on your website

For javascript
759
            PHP > how to run PHP on HTML Pages
 Rate this Page:    your vote is welcome
 Current rating:  2.80   out of 5 from   5   raters        

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 HTML/HTM website ,this can be a problem ,you'd heve 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 <? 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