Php and .htaccess and Stats

software development


Background: I’m trying to bootstrap myself into PHP and MySQL.

To allow the numerous files already in my website with .htm extensions to be recognized by PHP, I created a .htaccess file with a single line:

AddType php-cgi .html .htm

I put this file in the top level directory of the domain. My simple test of a standard “Hello World” PHP script running out of an .htm file in the same directory was a huge success.

However, when I went to get my Dreamhost Stats, I got a “no input file specified” message. Deleting the .htaccess file cured this Stats problem.

Now, there’s a bunch of documentation about how WordPress creates an .htaccess file that makes Dreamhost Stats inaccessible. I can’t see the parallel between the simple .htaccess file I created and the WordPress one. So I haven’t tried the recommended fixes. Yet.

Any direction/explanation would be appreciated. Even if it’s just a simple exhortation: Du-uh, Dave, why not just try the fixes and see if it freaking works?! Or just slap me down even harder, if you like. I’m hoping for a little more insight, though. Thanks. Cheers, HD


Update: So rummaging a bit further around on the web led me to try this for the contents of the .htaccess file

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

And this works brilliantly.