Forum Moderators: phranque

Message Too Old, No Replies

Can't get AddHandler right

Tried AddHandler to parse htm as php...no luck

         

stooper101

6:54 pm on Jun 18, 2008 (gmt 0)

10+ Year Member



Hi,

I'm trying to parse my .htm pages as .php. The server I'm on is running Apache 2 and PHP 4. I have several pages that have the .htm extension. Instead of changing the names, I wanted to just change the way the server is parsing these pages. After looking through the forums, it looks like if you add:

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

to the .htaccess you should be able to do just that.

I have tried that line (and many variations of that line), with no luck. I've tried placing "RemoveHandler htm html" in there as well, with no luck.

It seems as though I should be able to go into httpd.conf and check the settings, but I can't see the file on my file manager list. Could there be another file to look for? Is it possible my host does not allow access to this file?

I've emailed tech-support a couple of days ago with my problem, but they have not gotten back to me. What kind of things should I be asking my host to get my problem resolved?

Thanks

jdMorgan

10:20 pm on Jun 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You use AddHandler if PHP is installed as a CGI, but you have to use Addtype if it's installed as a module -- or maybe it's the other way around... At any rate, check out the many previous posts (especially in the PHP forum library) for the various methods used to get this working. The original method used to 'hook' PHP into Apache was kind of a kludge, and we've had to live with this "try this, try that" approach ever since.

Jim

stooper101

8:46 am on Jun 19, 2008 (gmt 0)

10+ Year Member



I finally got it!

I went through about 50 combinations of:

-AddType application/x-httpd-php .htm .html .php
-AddHandler application/x-httpd-php .php .html
-AddType x-httpd-php .html .htm
-RemovHandlre .htm .html
-AddType x-mapp-php4 .html .htm .shtml
removeHandler server-parsed shtml

and plenty of other suggestions through-out the web, but I finally came across the one that worked for me:

AddHandler php-script .php .php4 .php3 .html .htm .phtml