parse php with .htm extension

Discussion in 'Installation/Configuration' started by simplyworks, Jul 13, 2006.

  1. simplyworks

    simplyworks New Member

    hello,

    were do I make the change so my clients can run php on a .htm or .html page.

    I all ready added the change to:
    /root/ispconf/httpd/conf/httpd.conf
    AddType application/x-httpd-php .php .php3 .php4 .htm .html

    and I also made the change to:
    /etc/httpd/conf/vhost/Vhosts_ispconfig.conf
    (adding the same)

    Started apache and then restarted ispconf with no luck.

    I have made these change before without an issue working on Mandrake 2006 without Ispconfig installed.

    Thanks,
    Ja
     
    Last edited: Jul 13, 2006
  2. TheRudy

    TheRudy Member

    Am i the only one who thinks that this is a bad as rotten egg? I mean running all htms as php.. Don't also really get what's the point. If clients can't make php files as they don't know what it is they for sure have no idea how to use php code..

    What's the trick here?
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    Please undo these changes, do not edit the file /root/ispconf/httpd/conf/httpd.conf as it is for the controlpanel only.

    You can add directives for the vhost in the apache directives window of the website. Changes in /etc/httpd/conf/vhost/Vhosts_ispconfig.conf will be overriden by ISPConfig.

    If you want to add that HTML files where parsed for all websites, you will have to edit the code in /root/ispconfig/scripts/lib/config.lib.php in the function make_vhost(...).
     
  4. simplyworks

    simplyworks New Member

    I have done for years it comes right from php.net
    http://us2.php.net/manual/en/print/security.hiding.php


    Secondly, I made the changes you recommended (till), but what I meant to say is with no luck it is not working.
    in /root/ispconfig/scripts/lib/config.lib.php

    if($web["web_php"]){
    if($apache_version == 1){
    $php = "AddType application/x-httpd-php .php .php3 .php4 .php5 .htm .html";
    }

    The pages still do not parse with the .htm extension on the new server.

    Thanks again,
    Ja
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Do you have an apache 1 or apache 2 installed? The line you posted above is only for apache 1 installations. Below there is also the configuration for apache2.
     
  6. simplyworks

    simplyworks New Member

    Nice catch, Till

    I made the change.

    for the 2 domains I already have set-up I had edited:
    /etc/httpd/conf/vhost/Vhosts_ispconfig.conf

    and found my error. I already added this line:
    AddType application/x-httpd-php .php .php3 .php4 .htm .html

    I also had to add these following line to the config file:
    <Files *.htm>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>
    <Files *.html>
    SetOutputFilter PHP
    SetInputFilter PHP
    </Files>


    And now it works perfect!

    Do I need to make any additional changes to:
    /root/ispconfig/scripts/lib/config.lib.php ?

    Thanks for all your help! Till
    Ja
     
    Last edited: Jul 13, 2006
  7. falko

    falko Super Moderator Howtoforge Staff

    No, I don't think so. :)
     
  8. sjau

    sjau Local Meanie Moderator

    I just use .htaccess to run files as PHP in certain folders. Maybe you want to use that:

     

Share This Page