Posted by Gary Hasler on 12/05/07 20:11
Norman Peelman wrote:
>
> Gary Hasler wrote:
> > I want apache to parse all .html files for php code. Our 'real' web
> > server is rented from ICDsoft ( php 5 on Apache on Linux whatever), and
> > their instruction is to add the following to the .htaccess file:
> > AddHandler application/x-httpd-php .html
> > ...which works great.
> >
> > However, our local in-office server for testing and viewing our sites is
> > Apache 2.0.55 with PHP 4.4.4 on Windows XP Pro. I have read everything
> > I can find, and have tried adding the following to the httpd.conf file,
> > in every combination I can think of:
> > AddHandler application/x-httpd-php .html
> > and / or:
> > AddType application/x-httpd-php .php .html
> >
> > but the page just gets sent as html without the php code being parsed at
> > all (and yes, I do restart Apache after each change). What am I doing
> > wrong?
> >
> > (Here's what httpd.conf contained before--note that it works just fine
> > for .php files:)
> > ScriptAlias /php/ "c:/php/"
> > LoadModule php4_module "c:/php/php4apache2.dll"
> > AddType application/x-httpd-php .php
> > Action application/x-httpd-php "/php/php.exe"
> > PHPIniDir "C:/php"
>
> Just add .html after .php on the AddType line like so:
>
> AddType application/x-httpd-php .php .html
>
> and it should work. Others will tell you that that is a bad idea in that
> it causes even pages that have no PHP in them to go through the PHP
> parser before getting sent out to the browser. But if you have a need
> for it then by all means...
>
> I do:
>
> .php .htm for any page that may be created by or contain PHP generated
> output. You can even add your own if you want - doesn't matter. Just
> don't over-ride a mime-type.
>
> anything else should get parsed as html or it's respective mime-type. I
> personally end static pages (no dynamic) with either .html or .shtml
>
> Norm
Thanks Norm;
however I figured out what was happening (always happens if I post a
question!)..
I had SSI turned on earlier in the httpd.conf and I guess it can't do
both?:
<Directory />
Options Indexes FollowSymLinks
Options +Includes
AddType text/html .shtml
# --THESE LINES HAD TO BE DELETED:
#AddOutputFilter INCLUDES .html
#AddHandler server-parsed .html
</Directory>
[Back to original message]
|