faqts : Computers : Programming : Languages : PHP : Installation and Setup : Web Servers : Apache

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

4 of 24 people (17%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

Want to inline php code in .html files in Apache 2.x, not just .php files. Worked in 1.x!

Jul 30th, 2005 23:02
atl, Digger Wombat, http://www.phppatterns.com/index.php/article/articleview/73/1/2/


A bit late I suppose, but google turns this site up a top of list when 
people ask "inline php apache" so here is the short form answer:

#First thing you need to do is to tell Apache to parse the HTML pages 
with PHP. 
#You either need to update httpd.conf (if you have rights to it) or 
a .htaccess 
#file (assuming Apache is configured to let you use them) containing 
#something like;
<Files *.html>
ForceType application/x-httpd-php
</Files>

#Of course you have already read php/install.txt and discovered 
#that AddType allows you to add to or override the MIME 
#configuration file mime.types for specific file types like .php
AddType application/x-httpd-php .php

# For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2.dll"

# configure the path to php.ini
PHPIniDir "C:/Windows"