Re: [Q] PHP code embedded in html files - What happens?

From: Date: Mon, 15 Mar 2004 02:49:32 +0000
Subject: Re: [Q] PHP code embedded in html files - What happens?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-180409@lists.php.net to get a copy of this message
At 6:01 PM -0800 3/14/04, Michael T. Peterson wrote:
When the following file, tmp.htm, is executed no output is produced. <html> <head> <title>Test</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php echo '<p>hello world</p>'; ?> </body> </html> However, when the name of the file is changed to tmp.php the expected output, 'hello world', is obtained. Is this the correct behavior? More specifically, is the php script not executed? Cheers,
That is the conventional behavior, yes. If you want PHP to be invoked on files with an .html extension, you can (assuming you use Apache) change the line in httpd.conf that looks like this AddType application/x-httpd-php3 .php to this AddType application/x-httpd-php3 .php .html See http://www.php.net/manual/en/install.apache.php for more info. steve -- +--------------- my people are the people of the dessert, ---------------+ | Steve Edberg sbedberg@ucdavis.edu | | University of California, Davis (530)754-9127 | | Programming/Database/SysAdmin http://pgfsun.ucdavis.edu/ | +---------------- said t e lawrence, picking up his fork ----------------+

« previous php.general (#180409) next »