Welcome to WebmasterWorld Guest from 54.159.250.110

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Problem with phrasing html file as php

   
3:13 pm on Dec 3, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am having little (or big) problem with using php code on a .html file.

I did added

AddType application/x-httpd-php .html

in the .htaccess file, but whenever above code is present in the .htaccess file, it does not allow users to view the pages, instead it is asking for download/save the file on computer.

I was wondering if someone can help me out.

P.S... current .htaccess file looks like

AddHandler server-parsed .html
AddHandler server-parsed .htm

3:20 pm on Dec 3, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think I figured out the problem. If .htaccess file has both

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

in it, it will not work and I guess hence the problem.

Now can anyone tell me how can I phrase SSI and PHP on .html page? without facing this problem?

Thanks for the help.

3:32 pm on Dec 3, 2002 (gmt 0)

WebmasterWorld Senior Member marcia is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I don't know how to put it together with PHP, but mine looks like this:

AddHandler server-parsed .html .htm .shtml

3:49 pm on Dec 3, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If I am not wrong

AddType application/x-httpd-php .html
is used for using php code on page.html type of pages

&

AddHandler server-parsed .html
is used to use SSI code on page.html type of pages.

I have not used
AddHandler server-parsed .html .htm .shtml
But I think what it does is will allow you to use SSI code on .html .htm and .shtml pages. But then there is no need to put .shtml at the end, cuz, .shtml pages can anyway use SSI.

But still the problem of using both .php and ssi on a .html page stands :(

6:54 pm on Dec 3, 2002 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



You can't. One parser or the other not both.

You shouldn't need to anyway, you can use php to do all of the same things ssi does.

I use a setup like this

.htm - plain vanilla html
.html,.php - php parsed
.shtml - ssi

6:56 pm on Dec 3, 2002 (gmt 0)

10+ Year Member



I don't think it is possible to have files processed by two modules at the same time, so you can't have both SSI and PHP on the same files.

PHP has the same abilibites as SSI in terms of file inclusion and conditionals, so all you need is PHP.

René.

7:27 pm on Dec 3, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can chain handlers when you access the Apache API directly. mod_perl lets you do that (yeah) :) mod_php does not (sucks) :( You could write a little C program to to that as well.

Andreas