Re: PHP Code in .html/.htm pages
| From: | John Coder | Date: | Thu, 28 Nov 2002 00:25:40 +0000 |
| Subject: | Re: PHP Code in .html/.htm pages | ||
| References: | 1 | Groups: | php.install |
| Request: | Send a blank email to php-install+get-9265@lists.php.net to get a copy of this message | ||
On Wed, 2002-11-27 at 18:57, Robert W. Kramer III wrote:
>
> If I name my file .php and run the printinfo() routine, I get output. But
> when the file is named .html or .htm, the printinfo() just displays in the
> page.
>
> Is there a way to get .html files to execute the PHP code within them? For
> example, the following code will only work from within a file with .php as
> the extension:
>
> (index.php)
> <?php
> print ("Hello World!<P>");
> phpinfo();
> ?>
>
> This will display as expected showing the PHP environment in pretty tables.
>
> When I rename index.php to index.htm, I get output that looks like this:
>
> "); phpinfo(); ?>
>
> Can't PHP code be inserted in .html named files?
I believe it can by adding to your web-servers conf file .
in apache 1.2.37 it would be
AddType application/x-httpd-php .html
Check your web-servers docs to be sure.
John Coder