M3Server Technical Blog FAQ Mini Howto: Make PHP work in your html files

Mini Howto: Make PHP work in your html files



In order to make the server execute html files as php, you need to insert a directive in your .htaccess file as follows:

AddHandler application/x-httpd-php .html .htm

Remember, you should only have one AddHandler directive. Apache will read your .htaccess from top to bottom. Having two Addhandler directives will override the previous statement, as will having another .htaccess in a sub directory.

The above statement will execute html or htm file extensions as php on M3Server systems.

If you need to use old fashioned server side includes, you will need to use the php variation rather than than the old .shtml files as the above directive will direct Apache to use php instead of parsed.

Example of shtml files as html:
AddHandler server-parsed html

The above will treat html pages as .shtml pages for server side includes. This is not very common these days as most modern programming uses php instead of old school SSI (server side includes).

Travis
– M3server.com

Leave a Reply