Server side include solution

Discussion in 'General troubleshooting' started by jwhitty, Apr 29, 2011.

  1. I recently made an emergency transition of a customer site over to Winhost, and it didn't occur to me that Server Side Includes wouldn't be available, I mean they're just such a basic feature right?

    Anyway, I'm not going to whinge about a feature I'm not getting, in stead I'm going to do something productive and share my solution to this problem.

    To get this customer running as fast as possible, I simply converted their server side includes over to php includes. I then had to add a handler for shtml (all of their files with includes were .shtml files) and tell the php engine to process them.

    So convert all of these
    Code:
    <!--#include virtual="include.htm"-->
    over to
    Code:
    <?php include("include.htm");?>
    And in the IIS Manager (not in the control panel), under "Handler Mappings", we need to add a new "Script Mapping" that takes *.shtml and executes C:\php\php5isapi.dll

    Voila, all of my shtml files are now processed like php and the includes run.

    Disclaimer! I'm not claiming that this is a great best practice, but I was in a hurry and it works.

    I hope this saves someone else from the half day it's wasted of mine trying to sort out a solution.

    Jeff
     
    Last edited by a moderator: Oct 14, 2015

Share This Page