PHP in HTML

PHP in HTML

Posted by: runaway
Posted on: 2008-04-13 07:05:00

Does DreamHost support PHP in HTML. I am embedding some PHP code in my HTML and doesn't appear to work. However a .PHP file displays fine

Re: PHP in HTML

Posted by: Alpicola
Posted on: 2008-04-13 10:14:00

In order to execute PHP code, the file must have a .php extension, or you need to use a .htaccess file to add a PHP handler to .html files. Of the two, the preferred thing is to just rename your files to give them the correct (.php) extension.

Re: PHP in HTML

Posted by: seiler
Posted on: 2008-04-13 14:24:00

You can add something like this to your .htaccess file:

AddHandler php5-cgi .html

I wouldn't call that running PHP within HTML, though. It's really just treating .html as .php. So, all of your .html files are treated as PHP, not just the ones with PHP code in them.


Re: PHP in HTML

Posted by: runaway
Posted on: 2008-04-14 06:30:00

thanks heaps to those that pointed me in the right direction.

Got it working now - Cheers

Tags: php filephp code