Click to See Complete Forum and Search --> : Apache- reading PHP as html files?


adamhhh1
05-08-2007, 08:28 AM
right i hope this is the right forum-

we have html files which contain standard php code (including php tags etc). Is there a way to set up your web server to read these .html files to recognise the php? at the moment its just printing out the code.

And nope we cant simply rename to .php :(

laserlight
05-08-2007, 02:14 PM
Yes. In httpd.conf, look for
AddType application/x-httpd-php .php
Change that line to:
AddType application/x-httpd-php .php .html

bradgrafelman
05-08-2007, 06:57 PM
Note that this will cause all .html files to be run through the PHP parser, adding more load than normal to your server.

If you can isolate these .html files into a directory, and if the mod_mime module is enabled, you can use the [url=http://httpd.apache.org/docs/1.3/mod/mod_mime.html#forcetype]ForceType[/man] directive in a .htaccess file within that directory, resulting in a lesser load than as if you had parsed all .html files through PHP.