#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2009
    Posts
    28
    Rep Power
    0

    Configure IIS7 to run php within html


    Hi. I'm fairly new to server management, so bear with me (and sory for my english). I'm have successfuly installed and configured Windows Web Server 2008 R2/IIs7 and PHP 5.3.5 (I know it works because I can run *.php files/scripts just fine), but I have one problem. It doesn't run php scripts within *.html files. Let's consider the following code:
    Code:
    <html>
    <head><title>TITLE</title></head>
    <body>
    <?php echo("Hello ");?>
    world!
    </body>
    </html>
    The output to the above code is:
    <?php echo("Hello ");?> world!
    Does anyone know how to configure IIS to handle PHP within HTML? Thank you in advance. Bye.
  2. #2
  3. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,648
    Rep Power
    1945
    You can rename all .html files to .php - myFile.html is renamed to myFile.php.

    From a performance and compatibility point (e.g. have to move to another hosting provider) , it is not recommended to parse .html as PHP files.
  4. #3
  5. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,439
    Rep Power
    4539
    If it's your own server you can visit the IIS setup that maps file extensions to handlers and change to have .html go through the php interpreter. But unless you really need to make this change I'd recommend against it.
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester

IMN logo majestic logo threadwatch logo seochat tools logo