Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 30
  1. #1
    Member
    Join Date
    Apr 2004
    Location
    Israel
    Posts
    22

    Default Allow PHP in Htm and HTML pages

    Running WHM and CP 11.+++

    PHP 5

    I have changed the htaccess files on the web site and on the server but I can not get php to work in a html page.

    I tried with AddType application/x-httpd-php .php .htm .html

    and also RemoveHandler .html .htm
    AddType application/x-httpd-php .php .htm .html

    I want to add a header. The webpages are built from a template. I am adding a header in an editable region.

    Any suggestions. It is a huge web site and it would take at least a week to switch the whole website to php.

    Thanks

  2. #2
    Member UBERHOST's Avatar
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    102

    Default

    Have you tried enabling this through cPanel?

    Apache Handlers

    Create An Apache Handler

    Handler x-httpd-php

    Extension(s) .html

    Click "Add".

    click logo to visit us for dedicated
    cPanel servers and more

  3. #3
    Member
    Join Date
    Apr 2004
    Location
    Israel
    Posts
    22

    Default php

    I added the handlers and still no luck.

    <!-- InstanceBeginEditable name="EditRegion4" -->
    <div align="left"><?php include("header.php"); ?></div>
    <!-- InstanceEndEditable --></div>

    This is the page. http://www.unityinchrist.com/john/phptry.html

    the htacess now looks like this for the website
    # -FrontPage-

    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

    <Limit GET POST>
    order deny,allow
    deny from all
    allow from all
    </Limit>
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    </Limit>
    AuthName www.unityinchrist.com
    AuthUserFile /home/pbenson/public_html/_vti_pvt/service.pwd
    AuthGroupFile /home/pbenson/public_html/_vti_pvt/service.grp
    Redirect temp /gbook.html http://guestbooks.christiansunite.co...gi?u=pambenson
    AddType application/x-httpd-php .html
    AddHandler x-httpd-php .html
    AddHandler x-httpd-php .htm
    Last edited by cmwh; 08-11-2008 at 06:27 AM.

  4. #4
    Member
    Join Date
    Jul 2006
    Posts
    7

    Default

    edit your htaccess and use the following

    AddHandler application/x-httpd-php5 .htm
    AddHandler application/x-httpd-php5 .html

  5. #5
    Member
    Join Date
    Apr 2004
    Location
    Israel
    Posts
    22

    Default php

    edit your htaccess and use the following

    AddHandler application/x-httpd-php5 .htm
    AddHandler application/x-httpd-php5 .html
    Did not work

    Here is the two pages I out up

    http://www.unityinchrist.com/phptry.php This works fine

    This does not work http://www.unityinchrist.com/phptry.html

  6. #6
    Member
    Join Date
    Jul 2006
    Posts
    7

    Default

    Please post your current htaccess

  7. #7
    Member
    Join Date
    Apr 2004
    Location
    Israel
    Posts
    22

    Default current htacess

    # -FrontPage-

    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

    <Limit GET POST>
    order deny,allow
    deny from all
    allow from all
    </Limit>
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    </Limit>
    AuthName www.unityinchrist.com
    AuthUserFile /home/pbenson/public_html/_vti_pvt/service.pwd
    AuthGroupFile /home/pbenson/public_html/_vti_pvt/service.grp
    Redirect temp /gbook.html http://guestbooks.christiansunite.co...gi?u=pambenson
    AddType application/x-httpd-php .html
    AddHandler x-httpd-php5 .html
    AddHandler x-httpd-php5 .htm

  8. #8
    Member
    Join Date
    Jul 2006
    Posts
    7

    Default

    remove AddType application/x-httpd-php .html and try again

  9. #9
    Member
    Join Date
    Apr 2004
    Location
    Israel
    Posts
    22

    Default

    No luck it didn't work

  10. #10
    Member
    Join Date
    May 2005
    Posts
    100

    Default

    Open up /usr/local/apache/conf/mime.types (I am using Apache 2.2 - perhaps the configuration is in httpd.conf for earlier versions) and find out what MIME type corresponds to PHP. Then add the following to your .htaccess file:

    AddHandler mime-type-goes-here .html

  11. #11
    Member dave9000's Avatar
    Join Date
    Apr 2003
    Location
    arkansas
    Posts
    891
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Go into your cpanel for the site and then go to apache handlers

    add server-parsed .htm and server-parsed .html

    then add this to your .htaccess file

    AddHandler application/x-httpd-php .htm
    AddHandler application/x-httpd-php .html
    AddType application/x-httpd-php .htm
    AddType application/x-httpd-php .html
    Dave Browning
    Intersite Technologies
    Greenbrier Ar
    dave@isitetech.com

  12. #12
    Member
    Join Date
    Apr 2004
    Location
    Israel
    Posts
    22

    Default Tried everything

    I have tried all the suggestions and nothing works.

    my htacess now looks like this;

    # -FrontPage-

    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

    <Limit GET POST>
    order deny,allow
    deny from all
    allow from all
    </Limit>
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    </Limit>
    AuthName www.unityinchrist.com
    AuthUserFile /home/pbenson/public_html/_vti_pvt/service.pwd
    AuthGroupFile /home/pbenson/public_html/_vti_pvt/service.grp
    Redirect temp /gbook.html http://guestbooks.christiansunite.co...gi?u=pambenson
    AddHandler x-httpd-php5 .html
    AddHandler x-httpd-php5 .htm
    AddHandler application/x-httpd-php .htm
    AddHandler application/x-httpd-php .html
    AddType application/x-httpd-php .htm
    AddType application/x-httpd-php .html

  13. #13
    Registered User
    Join Date
    Oct 2007
    Location
    Chicago
    Posts
    2

    Default Allow PHP in Htm and HTML pages

    I see this never got completely answered because I am having the same issue. We just took on a new client and from their old company they had PHP in html pages. I have tried all the suggestions posted here and they do not work.

    here is the contents of my .httaccess file.

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

    When i look at the file through file manager index.html type is listed as application/x-httpd-php

    however, when browsing the file Firefox tries to download the file and IE shows the php code at the top.

    if i rename the file to php it works fine but we do not want to go through the entire site and remap everything. Does anyone have another suggestion?

    thank you.

  14. #14
    Member dave9000's Avatar
    Join Date
    Apr 2003
    Location
    arkansas
    Posts
    891
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Do this like I posted above

    Go into your cpanel for the site and then go to apache handlers

    add server-parsed .htm and server-parsed .html
    Dave Browning
    Intersite Technologies
    Greenbrier Ar
    dave@isitetech.com

  15. #15
    Registered User
    Join Date
    Oct 2007
    Location
    Chicago
    Posts
    2

    Default

    as i said i tried all the suggestions above and still can't get it to work.

Similar Threads & Tags
Similar threads

  1. Creating php/html pages on different accounts
    By nickmartin in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 09-02-2008, 05:42 AM
  2. Word to HTM and to HTML? How?
    By wimour in forum New User Questions
    Replies: 1
    Last Post: 05-11-2008, 01:49 PM
  3. EA3 mime types and parsing .htm pages as php
    By tkerns in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 05-04-2008, 11:34 AM
  4. How can I make pages load regardless if .htm or .html is called?
    By BianchiDude in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 12-01-2005, 03:06 PM
  5. Force a header to appear on every htm, html, and php file on
    By fog in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 12-13-2002, 11:03 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube