[php-maint] Bug#687418: Updating php5 to 5.4.4-5 broke FastCGI setup on my machine

Konstantin Khomoutov flatworm at users.sourceforge.net
Mon Sep 17 15:57:57 UTC 2012

On Mon, 17 Sep 2012 17:28:44 +0200
Ondřej Surý <ondrej at debian.org> wrote:

> > I'm by no means an expert in setting up this sort of complicated
> > stuff in Apache, so I can't really tell if this new change in php5
> > packaging introduces a regression or it's just a misconfiguration
> > on my part. In the latter case, it would be cool if someone could
> > provide me with any hints on how to configure handling of PHP
> > scripts by FastCGI server-wide (rather than patching each
> > PHP-enabled vhost using that <FilesMatch> override).  Any
> > suggestions?
> The NEWS file for php5-cgi which you ought to read when upgrading
> reads:
> --cut here--
> php5 (5.4.4-5) unstable; urgency=low
>  Please be aware that the mime-support package has dropped
> non-standard definitions for PHP that might affect any systems using
> PHP 5 running as CGI or FastCGI.  The following definitions were
>  all previously defined extensions.  ****Even though we believe that
> this configuration should keep your PHP scripts interpreted, it might
> be a good idea to check your apache2 site-wide configuration as well
> as any specific PHP configuration for websites running on your
> system.****
> --cut here--
> I am currently thinking how to accomodate all types of users (cgi and
> fastcgi), but I haven't come to any conclusion yet. If you have an
> idea, how to not break the configuration for neither CGI nor FastCGI
> users, feel free to share.

The problem is that I did read the release notes [*], but I failed to
make out any connection between MIME types and FastCGI; unfortunately
I'm not able to make it out completely even now.

Let me try to explain.
The configuration snippet which used to work for me, that is,

<IfModule mod_fcgid.c>
  AddHandler   fcgid-script .php
  FCGIWrapper  /usr/bin/php-cgi .php

does not mention any MIME types, I mean there's nothing referring to
things like "application/x-httpd-php" -- the snippet just basically
sets a handler for files ending in ".php" and then defines which binary
should serve as a handler for such files.  Consequently, when I'm
reading about changes in certain stuff involving MIME types, this does
not ring any bell for me as I'm not using that.

To me, it seems that the newly added snippet

<FilesMatch ".+\.ph(p[345]?|t|tml)$">
    SetHandler application/x-httpd-php

somehow has higher priority (or gets parsed later maybe?) than my
FastCGI config so that my AddHandler directive is effectively cancelled.
Is that correct?

In this case the correct approach to fix my setup seems to be somehow
setting that files assigned a handler "application/x-httpd-php" should
be served using FastCGI mechanics.  Can this be achieved?
To me, it looks like the handler name "fcgid-script" is builtin to
mod_fcgid, so the answer is "no".

Or is the correct thing for me is to just change

<FilesMatch ".+\.ph(p[345]?|t|tml)$">
    SetHandler application/x-httpd-php


<FilesMatch ".+\.ph(p[345]?|t|tml)$">
    SetHandler fcgid-script


In the latter case, I think the README.Debian file could just include
an entry on changing the default configuration to accomodate CGI or
FastCGI setups and the NEWS file could just redirect the user there.

[*] The funny thing is that I event proposed a small language-related
    fix to the first draft of this NEWS file entry on debian-devel ;-)

More information about the pkg-php-maint mailing list