Run php from HTML file

| 2 Comments

The scenario is I have a blog powered by Movabletype. All html files. Later I need it to be running like a php file. Then I can add php codes inside without changing extension name from html to php.

I'd like to keep the URL. The blog is about five years old.

OK.

Two years ago, I add the following into .htaccess file, which is from "Let php engine handle html as php".
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html

It works very well until last week.

I got the error like ask me save the file or not. It is not return the correct php or html file.

I did a lot of research. No answer. I have to submit the ticket to host provider. He gave me the answer and solution.

Your.htaccess file is telling our server to send your .html and .htm
files through the PHP interpreter loaded into apache as a module
(mod_php). We haven't supported that setup for about 4 or 5 years now,
but we've left it running for the convenience of people still relying on
it to work. PHP version 4 is now so out of date that leaving it running
makes our servers fail security scans though, so we've been forced to
disable it.

You'll want to comment out any lines like this:
AddType application/x-httpd-php .html .htm


And change it to something like this...
AddType php5-cgi htm html

This will make your scripts run through our PHP5 binary instead. Let me
know if you have any other questions!

Thanks!
Jeff H

Good. It really helped me out.



2 Comments

Thanks for sharing this! I spent (wasted) quite a bit of time this morning trying to get my site working. Just a simple matter of changing a line in the .htaccess, works perfect!

Myuuu~~ it works ^__^ i was searching for this for ages - dreamhost blogs said to do other stuff, but they were old, so makes sense..


lets-a-go PHP~~~

Leave a comment

About this Entry

This page contains a single entry by David Yin published on May 11, 2009 10:28 AM.

iPod to Computer Transfer was the previous entry in this blog.

Vote for next four years in BC is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

OpenID accepted here Learn more about OpenID
Powered by Movable Type 5.02

Subscribe

Online Tools

Code Convertor