[php-maint] Bug#670945: Bug#670945: Bug#670945: About the media types text/x-php and text/x-php-source

Ondřej Surý ondrej at debian.org
Wed Aug 29 07:28:20 UTC 2012

On Wed, Aug 29, 2012 at 2:29 AM, Charles Plessy <plessy at debian.org> wrote:
> Dear Ondřej and everybody,
> I would like to keep separate the two following issues.
>  1) Whether or not to give a private media type to PHP files in Debian, and
>     if yes, which one.
>  2) Provide a smooth upgrade to our users who use Apache's mod_negociation in a way
>     that is different to what is recommended in PHP (where the FAQ suggests to associate
>     the media type "text/html" to .php files).
>     http://www.php.net/manual/en/faq.installation.php#faq.installation.apache.multiviews
> Point 2) can be solved by adding two lines (plus explanatory comments) in
> /etc/apache2/mods-available/php5.conf (http://bugs.debian.org/670945#26).
> Ondřej, I would appreciate if you solved #670945 this way.  I understand that it
> puts the work burden on your shoulders and that php5 is a much heavier package
> than mime-support, but I think that it is the cleanest solution.  For the moment
> I have not received any message saying that a media type needs to be provided by
> mime-support in order for PHP to work in other contexts.

With much cooler head and weekend after me and after carefull
consideration of Chris's
comments I have decided to go with:


php5 (5.4.4-7) unstable; urgency=low

  * As a side effect of MIME-Type changes in the mime-support package, the
    default Apache 2 configuration doesn't support MultiViews negotiation,
    which was very fragile anyway.  If you want to re-enable this support
    please see /usr/share/doc/php5-common/README.Debian file for
    instructions to re-add MIME-Types in Apache 2 configuration or how to
    use mod_rewrite to accomplish the same without the fragility of Multi-

 -- Ondřej Surý <ondrej at debian.org>  Wed, 29 Aug 2012 09:18:41 +0200



PHP 5 and Apache 2 Multiviews

 Apache 2 mod_negotiation's MultiViews needs php scripts to have a
 MIME-Type to make the negotiation work.  We are using Apache 2 handlers
 (SetHandler directive) to enable PHP processing, so by default the
 MultiViews support is disabled in Debian packages.  You can explicitly
 add extra MIME-Types (different from magic application/x-httpd-* types)
 which will not cause any special PHP processing, but just enable
 MultiViews negotiation support.

 Add these two lines to you Apache 2 config to enable MultiViews:

   AddType application/x-php         php phtml php3
   AddType application/x-php-source  phps

 Also most likely what you really want would be better accomplished by
 mod_rewrite rules where you can explicitly specify what gets
 rewritten to what (e.g. http://localhost/file gets rewritten to
 file.php, but not to file.html or file.js).

<I would like to add text here with instructions how to enable
mod_rewrite handling.>

Ondřej Surý <ondrej at sury.org>

More information about the pkg-php-maint mailing list