Forum Moderators: phranque

Message Too Old, No Replies

Enabling PHP parsing with different file extensions

Why won't .shtml files parse?

         

jfodale

10:05 pm on Nov 30, 2007 (gmt 0)

10+ Year Member



I'm trying to add PHP parsing capabilities to .shtml files, specifically. I've heard that you can enable this by simply adding the following line to an .htaccess file:

AddType application/x-httpd-php .shtml

Nothing happened. While I futilly tried to fix it, I decided to add some other extensions in there and see what happened:

AddType application/x-httpd-php .shtml .htm .html

.htm and .html are now able to parse PHP! But still no luck with the .shtml files. What's the deal there? And is there a workaround of any type?

jfodale

10:14 pm on Nov 30, 2007 (gmt 0)

10+ Year Member



Fixed, after beating myself in the head for a couple hours it randomly gets solved by messing around just moments after I ask for help, of course...

Seems AddHandler, not AddType is the way to go.

jdMorgan

10:49 pm on Nov 30, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




AddHandler server-parsed .shtml

is the 'orthodox' way to handle this. However, early PHP implementations used the AddType kludge, so we've been stuck answering questions like yours with "try it both ways and hopefully one of them will work" ever since then.

Jim

[edited by: jdMorgan at 10:56 pm (utc) on Nov. 30, 2007]