If I create a simple .html file with a table inside it. Within one of the columns of a table, if I insert PHP opening and closing tags, and even just type echo, it is not working. Do I need to change the extension of the file to .php?
+6
A:
Changing the file to .php would be the quickest solution.
An alternate solution would be to use Apache's addType to allow apache to serve PHP pages with a different extension.
AddType application/x-httpd-php .html .htm
Duroth
2009-11-04 08:36:41
+1 for AddType! Didn't know that one
Kaze no Koe
2009-11-04 08:39:37
A:
The webserver needs to know it has to process the file through the php processor, instead of just giving it to the user as is the default for a .html file. So renaming to .php is the easiest way to get that.
If you use AddType, then all html files are going through the php processor, which might slow things down too much.
Hans Kesting
2009-11-04 08:48:32