Page Utilities

 
Articles

PHP as HTM/HML:

Why?

This modification is sometimes made simply to allow functionality of the FrontPage “Save Time” components on PHP pages, but it's also a good trick to use if you're adding PHP functionality to a previously HTM/HTML website and don't want to create tons of broken links.  This way your PHP code will function and no pages will need to be renamed.

Note; while the MIME type switch allows FrontPage “Save Time” web components (Include Content, Themes, Etc) it doesn’t allow “Run Time” components such as FrontPage forms and custom confirmation pages to run. For this reason I recommend doing the switch on HTM and reserving the HTML extension for those instances where you need a FrontPage form, or other runtime component.

  • It can be done on a web by web basis and is not a “server wide” modification
  • There’s no extra resource draw because the htm/html pages would have been PHP anyway.

How?

  • It’s actually quite simple; there are instructions below for both Windows and UNIX servers.
  • It’s easy to do on either system

What’s in it for you?

  • Your client will appreciate your help
  • You can also sign up as a ContentSeed Hosting Provider http://ContentSeed.com/resources.asp
  • Your client will have an easier time using the FrontPage interface to publish their work and not require support with unknown technologies and techniques

Windows Server

This information and example is IIS 6, but will be similar for other Windows servers. Obviously you’ll need PHP running on your server for this to be possible.

  • Go to your IIS control panel
    • Find the site in question and right click its root folder, chose “properties”.
    • Click the “Default Directory” tab, and then click the “Configuration” button in Application Settings.
    • Once you bring up the Application Configuration dialog box, click add.
    • You’ll have to add the extension .htm or .html and map it to the PHP executable file.
    • It’s easy to see where the PHP executable file is because it’s listed in the Configuration dialog.
  • When you’re done setting either the .htm or.html extensions your settings window will look similar to the picture below.

**Either the php-cgi.exe or simply php.exe depending on the version of PHP your server is running.

NOTE: It’s recommended only to apply this change to HTM OR HTML

UNIX Servers

Running PHP code on HTM/HTML pages requires a very simple edit of the HTACCESS or Apache configuration file.

  • Enable PHP work on .htm/.html pages

    1st method:

    • Download the .htaccess file from the root web folder and add one of the following strings:

      AddType application/x-httpd-php .htm
      AddType application/x-httpd-php .html

      Then upload the edited file back to the server.

    2nd Method

    • Your server may have a “control panel” for the virtual host where you can add the above code. The process may be slightly different, but the code is identical.
      • If you have a control panel such as “Plesk”, “C-Panel”, “H-Sphere”, etc. It’s very easy to do this switch right through the interface. Contact Me for specific instructions.

NOTE: It’s recommended only to apply this change to HTM OR HTML

Visit ContentSeed.com for information on becoming a Hosting Provider. If you have any questions regarding the following operations, see our AnswerDesk.

 

Chris Leeds , MVP, WPD
Chris Leeds is a long time digital photographer and web enthusiast.
Chris has recently developed and released a software product that allows webmasters to easily create web sites that can be edited and managed with just a browser.
See: http://ContentSeed.com/
Chris also maintains and operates Northeast Digital Photo:
http://nedp.net/
Chris has also had "Tips and Tricks" published on Microsoft's site regarding various facets of FrontPage and recently served as a technical reviewer for the O'Reilly Press "FrontPage the Missing Manual".
If you'd like to republish this or other articles just Contact Chris.

 
Warning!: You're seeing an unformatted version of this page.
This is because you're using a very old browser or the style sheet has failed to load.
I put this message here so you wouldn't think this unformatted version is something I designed. ;-)