httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen van Egmond <>
Subject Re: mod_negotiation and PHP
Date Sun, 02 Feb 2003 18:21:26 GMT
Glenn ( wrote:
> # (unset mime-types will use the DefaultType, which defaults
> #  to text/plain on a standard Apache installation)
> RemoveType .php
> # or you can specify a mime-type as
> #AddType text/html .php
> # Tell Apache that mod_php is the handler for .php
> AddHandler php-script .php

This unfortunately still results in the same behaviour,
I believe (from the source) because the php-script handler
is still committed to producing application/x-httpd-php 

Odd thing: I re-did my modifications to the Apache source, and this
time it works.  The PHP handler's mime type is now promoted to text/html
for the purposes of content negotiation.   I discovered that modifying
includes/httpd.h this way:

#define INCLUDES_MAGIC_TYPE3 "text/x-server-parsed-html"
#define INCLUDES_MAGIC_TYPE "application/x-httpd-php"

works, whereas swapping them:

#define INCLUDES_MAGIC_TYPE "text/x-server-parsed-html"
#define INCLUDES_MAGIC_TYPE3 "application/x-httpd-php"

does not.  From what I can see, mod_negotiation tries to treat
them identically thoughout.  So perhaps there is something being
dropped there.

I realize that PHP isn't a standard apache module, and adding
standard infrastructure to do this kind of quackery would probably
be difficult (as the patches would have to go into both Apache and
PHP).  I'm  content to just let the mailing list archives of the world
record this hack/solution, and move on.

Thank you for all your help.

View raw message