Results 1 to 5 of 5

Thread: .htaccess forcing PHP

  1. #1
    Join Date
    Jun 2005
    Location
    Canada
    Posts
    68
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Question .htaccess forcing PHP

    I am currently on a server with GoDaddy (sorry for the advert - I get nothing out of it) and it is set up with PHP3 and PHP4 according to the control panel. I am in the process of learning MySQL and other PHP driven applications so I tested the PHP and it is not working.
    So, I placed
    AddHandler application/x-httpd-php .php
    into the .htaccess since it is my understanding that this would force the server to recognize the page and it has not.
    I have a test page at http://www.asseen-ontvsite.com/test.html with a simple date which is not doing a thing. I tried another Addhandler (can't recall which one) and it blocked my index page and forced me to download (which of course I didn't since I already have it) but left the subdomains intact.
    Any guidance for a very impatient newbie would be greatly appreciated.

    For the record, this is what my .htaccess file looks like at the present time

    # -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.asseen-ontvsite.com
    AuthUserFile /var/chroot/home/content/d/i/v/diversions/html/_vti_pvt/service.pwd
    AuthGroupFile /var/chroot/home/content/d/i/v/diversions/html/_vti_pvt/service.grp

    AddHandler server-parsed .htm
    AddHandler server-parsed .html
    AddHandler application/x-httpd-php .php

    Thanks for your help

    D

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Just to clarify, are you trying to enable PHP on .htm and .html pages, or simply .php? I ask this because the test page you cited above is test.html, which per your server setting will be parsed for SSI, not PHP. The line:

    Code:
    AddHandler application/x-httpd-php .php
    simply tells the server to enable PHP on .php pages.

  3. #3
    Join Date
    Jun 2005
    Location
    Canada
    Posts
    68
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Default

    I am trying to enable PHP....but your question just taught me a lot. So am I to understand then that if I rename the page extension to .php it is a winner? Or, if I were to include html or htm in the htaccess file it would work on any type of page?

    Thanks DD

    D

  4. #4
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Code:
    So am I to understand then that if I rename the page extension to .php it is a winner? Or, if I were to include html or htm in the htaccess file it would work on any type of page?
    Yep, PHP should work for .php pages by default on most servers, assuming it supports PHP. The point of using .htaccess is often to enable certain features on non standard extensions, such as PHP for .htm and .html pages. That means .htm/.html pages would be parsed for PHP when that happens.

  5. #5
    Join Date
    Jul 2005
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    OP, did you get it sorted out? Please tell us if this fixed your problem.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •