Running html files as php

Discussion in 'Site & Server Administration' started by TechMaster, Mar 17, 2010.

  1. #1
    I have html files on my site. I want server to process html files as php. In htaccess I added line as below....

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

    It is not working. After adding aforementioned lines in htaccess file is getting download instead of getting opened as webpage.

    Note: In html file i have added some php code.
     
    TechMaster, Mar 17, 2010 IP
  2. zacharooni

    zacharooni Well-Known Member

    Messages:
    346
    Likes Received:
    20
    Best Answers:
    4
    Trophy Points:
    120
    #2
    Hello,

    Instead of AddType, you may want to try AddHandler.

    Remove the ForceType/AddType and add this:

    AddHandler application/x-httpd-php5 .htm .html
     
    zacharooni, Mar 17, 2010 IP
  3. TechMaster

    TechMaster Peon

    Messages:
    225
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I did add those lines.

    Files are being processed and displayed as web page, however it does not include the file. In html file i have added below code....

    <? include('index-related.html'); ?>

    It is not calling that file.
     
    Last edited: Mar 17, 2010
    TechMaster, Mar 17, 2010 IP
  4. killaklown

    killaklown Well-Known Member

    Messages:
    2,666
    Likes Received:
    87
    Best Answers:
    0
    Trophy Points:
    165
    #4
    do you have short tags enabled? if not you would need

    <?php include('index-related.html'); ?>
     
    killaklown, Mar 18, 2010 IP