Web Hosting Talk







View Full Version : PHP in HTML documents


Haze
03-10-2002, 03:51 AM
Is there a way in which I can get php to function within an .html document?

serve-you
03-10-2002, 03:56 AM
Change the extension to .php and add a <? ?> at the beginning and end. I don't know of any way to do it with an .html extension.

-Dan

driverdave
03-10-2002, 04:19 AM
Go into httpd.conf and add this

AddType application/x-httpd-php .html

Restart apache and your set. Now all .html files will be parsed by php. Or at least they should, I've never attepmted anything like this. Give it a try.

Haze
03-10-2002, 04:38 AM
Originally posted by serve-you
Change the extension to .php and add a <? ?> at the beginning and end. I don't know of any way to do it with an .html extension.

-Dan

Im doing this for a client. He has told me his previous host was able to load php in .html documents. I have already suggested that he change the extensions and the customer is rather annoyed that they would have to go through and change all the extensions, and links.

Originally posted by driverdave
Go into httpd.conf and add this

AddType application/x-httpd-php .html

Restart apache and your set. Now all .html files will be parsed by php. Or at least they should, I've never attepmted anything like this. Give it a try.

Tried that already.. didn't work.

ho247
03-10-2002, 05:48 AM
Haze, could you send me your httpd.conf file? It's just a matter of adding .html next to .php in the file and then restarting Apache. But you may have some kind of custom setup on your httpd.conf file. I can take a look at it for you. PM it to me.

Alan

mkaufman
03-10-2002, 10:18 AM
Originally posted by Haze


Tried that already.. didn't work.

Restart apache if you didn't

OR try this:

AddType application/x-httpd-php .php .php3 .phtml .html

^^ I think that works..

Walter
03-10-2002, 10:52 AM
Do you really think it's good to parse nearly every file on the server as a PHP file? It will add some overhead...

priyadi
03-10-2002, 12:40 PM
If that's only for one client, use a .htaccess instead. That way the others wouldn't be affected.

Haze
03-10-2002, 07:13 PM
Good Idea.