problem using htaccess file to parse HTML files for PHP

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
snailface
Forum Newbie
Posts: 7
Joined: Wed Jul 26, 2006 7:03 am

problem using htaccess file to parse HTML files for PHP

Post by snailface »

I know that there are numerous posts on using an htaccess file to cause a server to parse HTML files for PHP. I've read them all (or at least most), but have not found any help for my problem.

Does anyone know of a situation where modifying the htaccess file (or adding one to a specific directory within a hosting account) would cause the following behavior?

I added an htaccess file consiting only of the line to a directroy where I would like .html files to be parsed for PHP:

AddType application/x-httpd-php .html .htm .php3 .phtml

But now, when I navigate to that directory (without specifying a file so that it should default to index) I get prompted to open or save a file.

If I navigate specifically to the file, it is displayed in the browser, but without the PHP having been parsed.

To see what I am talking about I put up some sample files.
To see the wierd file download behavior go to:
http://www.littlegreentoaster.com/testdir/

To see the HTML file without the PHP parsed:
http://www.littlegreentoaster.com/testdir/index.html

And to validate that PHP is installed and working
http://www.littlegreentoaster.com/testdir/index2.php

Thanks in advance to anyone who can shed some light on this for me.

-adam
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Have a read over this thread.
snailface
Forum Newbie
Posts: 7
Joined: Wed Jul 26, 2006 7:03 am

Post by snailface »

Thanks Everah. I'll look it over.
Post Reply