Helpful Information
 
 
Category: PHP / MySQL
Parsing HTML Files through PHP

Hi all,

Just signed up to the "holiday special" and now I feel special...bring on Santa :)

The only thing stopping me on the road to happiness is that I want to parse files with the extension .htm through the PHP parse, i.e. mysite.com/blah.htm is parsed with PHP.

My usual "cut and paste" bits of code end up with a message asking me to download the page, so I know I'm in need of something different. I assume the answer is placing a piece of code in my .htaccess folder since I have no acceess to http.conf?

Thanks for any advice on this matter. It will save me re-hacking scripts that I have made with the .htm extension!

Yes you should have access to your httpd.conf file. It is located here:
/usr/local/apache/conf/httpd.conf

It can be hard to find stuff at times. :)

I know you can change what is parsed by SSI and have played with that but not sure where the setting is on php. If you give the file a scan I imagin you can find it.

Also make sure you have all the correct Site Applications installed depending on what you are doing.

Class! I wouldn't have thought I had access to it. Thanks for pointing that out :)

Now, I changed the appropriate line (i think)

<IfModule mod_php4.c>
AddType application/x-httpd-php .php .htm .php4 .php3 .phtml
AddType application/x-httpd-php-source .phps
</IfModule>

though the test.htm file I have is not being parsed by PHP. Do I have to somehow reset the server myself or wait X amount of time do you know?

Thanks for replying so swiftly, muchly appreciated!

OK, after a little reading up I found the answer, for anyone reading this thread wondering the same thing, read the first post and latter posts of this thread.

http://forums.westhost.com/phpBB2/viewtopic.php?t=479&start=0

Thanks again for your help joker.

Glad you got it going. So I guess you had to do a restart? I should have said something about that but was not sure and in to much of a hurry to look it up... sorry.

yep, a restart from the control panel, and remove ".htm" from the file extensions dealt with by Apache's SSI includes, which is just below the PHP directives in the http.conf.

They explain it much better in that other thread ;)










privacy (GDPR)