Log in

View Full Version : .htaccess forcing PHP



Diversions
09-20-2006, 09:03 PM
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

ddadmin
09-20-2006, 09:16 PM
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:


AddHandler application/x-httpd-php .php

simply tells the server to enable PHP on .php pages.

Diversions
09-21-2006, 12:20 AM
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

ddadmin
09-21-2006, 12:45 AM
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.

xeno
09-29-2006, 01:22 AM
OP, did you get it sorted out? Please tell us if this fixed your problem.