Web Hosting Talk







View Full Version : PHP in htm problem


HWLJr
03-04-2010, 07:59 PM
I have a Blue Quartz server which seems to run htm, html and php pages just fine. I can call a test.php report up no problem too from domains and subs. However, I cannot embed a php statement in an htm page.

example from an htm page:
<div style="font-size: 11pt; font-family: Verdana; font-weight: bold; padding-top: 6px;
padding-bottom: 10px;">
March 22, 2010</div>
<?php echo "hello" ?>
</div>

this does not work - no Hello shows up. I might add that when I added the code the first time, it worked for about 5 minutes!

Thank you for any advice.

RS Shamil
03-04-2010, 08:11 PM
Try:

<?php echo "hello"; ?>

Notice the semicolon, delimiter.

leon234
03-04-2010, 08:21 PM
I believe if memory serves me correctly that the Page would have to be saved as a .php file for the php to be parsed by the php server. Unless you have configured php to parse .htm and .html files, which I dont think it is set to do by default.

HWLJr
03-04-2010, 09:05 PM
I believe if memory serves me correctly that the Page would have to be saved as a .php file for the php to be parsed by the php server. Unless you have configured php to parse .htm and .html files, which I dont think it is set to do by default.

and tried this but this did not work -
<?php echo "hello"; ?>

pardon my lack of knowledge - how/where can I configure the php to parse as you suggest?

Thanks

jweeb
03-04-2010, 09:11 PM
Did you save the file as a php file?

FrankLaszlo
03-04-2010, 09:15 PM
Most hosting companies are only setup to parse files ending with the '.php' extension through the php interpreter. You can override this default behavior by adding something like this to the sites .htaccess:


AddType application/x-httpd-php .htm


This may or may not work depending on how your server is configured.

HWLJr
03-04-2010, 09:16 PM
Did you save the file as a php file?

That works! I'll continue testing...
thank you

HWLJr
03-04-2010, 09:19 PM
Most hosting companies are only setup to parse files ending with the '.php' extension through the php interpreter. You can override this default behavior by adding something like this to the sites .htaccess:


AddType application/x-httpd-php .htm


This may or may not work depending on how your server is configured.

I'll try that too as I have none now.
Thanks