Monday, January 18, 2010

Run PHP Code in HTML files

If you want to run PHP Code in your static HTML pages, you need to create .htaccess file (if it is not already exists) in the directory of where all your html files exists and add the below lines of code

For web servers using PHP as apache module:


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

For web servers running PHP as CGI:


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

If your requirement is only for one page then use below code

AddType application/x-httpd-php .html

0 comments: